# A Perplexing Javascript Parsing Puzzle

**URL:** <https://forum.devtalk.com/t/a-perplexing-javascript-parsing-puzzle/192177>\
**Category:** In The News\
**Tags:** via-news-bot, javascript, in-the-news\
**Created:** [23 March 2025 02:39 UTC](https://forum.devtalk.com/t/a-perplexing-javascript-parsing-puzzle/192177 "2025-03-23T02:39:39Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![CommunityNews](https://forum.devtalk.com/user_avatar/forum.devtalk.com/communitynews/32/1113_2.png) [@CommunityNews](https://forum.devtalk.com/u/CommunityNews)\
**Post date:** [23 March 2025 02:39 UTC](https://forum.devtalk.com/t/a-perplexing-javascript-parsing-puzzle/192177/1 "2025-03-23T02:39:40Z")

</div>

> 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.

Read in full here:

> **[A Perplexing Javascript Parsing Puzzle](https://www.hillelwayne.com/post/javascript-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...
