console.log(b=1) // 1
Because assignment has a return value, we are able to chain assignments.
let a;
let b;
a = b = 1
console.log(a); // 1
console.log(b); // 1
Hard to read, but it works...
let a = 1;
let b = 2;
let c = 3 - (a = b + 1);
console.log(a); // 3
console.log(c); // 0
Oldest comments (11)
I think it's for REPL, so it will show the final result for assignment as well
If you're struggling with a challenging Do My ASSIGNMENT or need help with a marketing assignment, getting expert support can make all the difference. A reliable writing service can guide you through structuring, research, and editing, helping you save time while enhancing your work. Anyone have experiences with good services?
Some comments may only be visible to logged-in visitors. Sign in to view all comments.