DEV Community

Discussion on: 5 easy wins for cleaner Javascript code 🧹

Collapse
 
moopet profile image
Ben Sinclair

Your first example has the same code snippet for both the "good" and the "bad" version. I think you pasted the wrong one.

Collapse
 
mlevkov profile image
Mikhail Levkovsky

Not exactly :)
In the first example I use var, and in the second I use const
But I guess the example isn’t clear, thanks for the feedback I’ll update it

Collapse
 
moopet profile image
Ben Sinclair • Edited

In the first one you use const, and in the second one you use const!
The only difference is a line of whitespace.

Actually, looking forward, they're both really the snippet for your "for in... for of" comparison later in the post:

example 1

Thread Thread
 
mlevkov profile image
Mikhail Levkovsky • Edited

Wow that is super weird! The gists seem to be rendering out of order :/
Check the screenshot to see what should be there.
I wonder if there's anyway to get support on this from dev.to about this
Can you refresh the page please to see if it's still out of order?

screenshot

Thread Thread
 
moopet profile image
Ben Sinclair

It's working now :)

Thread Thread
 
mlevkov profile image
Mikhail Levkovsky

Thanks for flagging btw
FWIW I added a disclaimer to the top of the article to give people a heads up. So strange