In JavaScript, how to interpret the following statement:
cond1 && !await f()
This is an excerpt from a line.
if(cond1 && !await f()){ do_stuff(); }
inside a production application. chrome seems to be okay with it, but on ios it causes an error reading
unexpected identifier 'f'. Expected ')' to end an if condition.
It seems that 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?
ps: We fixed the code for ios by changing it to
var f_result = await f(); if(cond1 && !f_result){ do_stuff(); }
source share