if (foo = bar()) { // syntax error! } if (let foo = bar()) { // works fine } if (const foo = bar()) { // also works fine } if (var foo = bar()) { // also also works fine }
That's already an error in strict mode (which would presumably be on for anyone writing bleeding-edge JS).
i = 3; foo = \0; while ( i-- ) { if ( foo = resultFromFooApi() ) { break; } sleep 1; } return foo;