TLDR Web Dev · QUICK LINKS
A PERPLEXING JAVASCRIPT PARSING PUZZLE
Summary from the TLDR Web Dev newsletter
There's a surprising JavaScript behavior where `x = 1; x; // 0` evaluates to 1 because `-->` at the beginning of a line is interpreted as a legacy comment, a holdover from older browsers needing to ignore JavaScript within `script` tags.