✨ Behold, the marvel of modern programming: a #JavaScript #puzzle that confounds the unsuspecting 🧩. Devotees of code wizardry can now delight in the revelation that JavaScript's parsing prowess knows no bounds. But fear not, because the universe is saved by a dropdown explanation that rivals a dad joke in excitement 😴.
https://www.hillelwayne.com/post/javascript-puzzle/ #CodeWizardry #DropdownExplanation #ProgrammingHumor #HackerNews #ngated
A Perplexing Javascript Parsing Puzzle

What does this print? x = 1 x --> 0 Think it through, then try it in a browser console! Answer and explanation in the dropdown. Show answer It prints 1. wait wtf At the beginning of a line (and only at the beginning of a line), --> starts a comment. The JavaScript is parsed as x=1; x; // 0 The browser then displays the value of the last expression, which of course is 1.

Hillel Wayne