Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Only if you haven't already declared the variable. e.g.

    let x;
    console.log(x = 'hello');
My point is that the `x = 'hello'` part is an assignment, and an expression, and has the exact same semantics regardless of whether you use that expression as a statement. So, assignments would seem to be expressions.


Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: