CommunityNews

CommunityNews

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.

Read in full here:

/js
0 5 0

Popular General Dev topics Top

New
siddhant3030
I’m thinking of buying a monitor that I can rotate to use as a vertical monitor? Also, I want to know if someone is using it for program...
51 4075 20
New
AstonJ
I really like our #general-developer-forum:in-the-news section and am wondering whether we could automate some of the cross-posting of th...
62 2220 34
New
AstonJ
There’s a whole world of custom keycaps out there that I didn’t know existed! Check out all of our Keycaps threads here: https://forum....
15 7818 19
New
mafinar
I always start with excitement and then get busy on 9/10th day. This year, like the year before this, and the year before that, I intend ...
92 2732 57
New
New
hskohli
We are looking to hire a freelancer to design the complete pipeline for the following problem statement: Hardware to be used: Jetson Na...
2 1464 0
New
AstonJ
I’ve been watching Prag Dave’s Elixir course and I noticed he uses tree: Tree is a recursive directory listing program that produces a ...
87 1981 22
New
First poster: bot
Large Language Models like ChatGPT say The Darnedest Things. The Errors They MakeWhy We Need to Document Them, and What We Have Decided ...
0 2595 0
New
First poster: bot
zig/http.zig at 7cf2cbb33ef34c1d211135f56d30fe23b6cacd42 · ziglang/zig. General-purpose programming language and toolchain for maintaini...
0 2435 0
New

Other popular topics Top

siddhant3030
I’m thinking of buying a monitor that I can rotate to use as a vertical monitor? Also, I want to know if someone is using it for program...
51 4075 20
New
Rainer
My first contact with Erlang was about 2 years ago when I used RabbitMQ, which is written in Erlang, for my job. This made me curious and...
195 6223 95
New
Exadra37
On modern versions of macOS, you simply can’t power on your computer, launch a text editor or eBook reader, and write or read, without a ...
24 3384 24
New
Exadra37
I am a Linux user since 2012, more or less, and I always use Ubuntu on my computers, and my last 2 laptops have been used Thinkpads, wher...
64 2918 29
New
Margaret
Hello content creators! Happy new year. What tech topics do you think will be the focus of 2021? My vote for one topic is ethics in tech...
110 3689 43
New
dimitarvp
Small essay with thoughts on macOS vs. Linux: I know @Exadra37 is just waiting around the corner to scream at me “I TOLD YOU SO!!!” but I...
166 7374 69
New
AstonJ
Seems like a lot of people caught it - just wondered whether any of you did? As far as I know I didn’t, but it wouldn’t surprise me if I...
190 3595 79
New
AstonJ
We’ve talked about his book briefly here but it is quickly becoming obsolete - so he’s decided to create a series of 7 podcasts, the firs...
87 5714 49
New
PragmaticBookshelf
Rails 7 completely redefines what it means to produce fantastic user experiences and provides a way to achieve all the benefits of single...
32 2728 9
New
PragmaticBookshelf
Author Spotlight: Peter Ullrich @PJUllrich Data is at the core of every business, but it is useless if nobody can access and analyze ...
72 3684 21
New