operator precedence: ! and await

Viewed 641

In JavaScript, how is the following statement to be interpreted:

cond1 && !await f()

This is an excerpt from the line

if(cond1 && !await f()){
    do_stuff();
}

inside a production application. chrome seems to be fine with it, but on ios this causes an error reading

unexpected identifier 'f'. Expected ')' to end an if condition.

It looks as if ios turns !await f() into (!await)(f()) instead of !(await f()).

Now to my question: According to ECMA-262 what is the correct interpretation of the above line?

p.s.: We have fixed the code for ios by changing it to

var f_result = await f();
if(cond1 && !f_result){
    do_stuff();
}
1 Answers
Related