DEV Community

Cover image for 5 Strange Yet Funny Things That Only Happen in JavaScript

5 Strange Yet Funny Things That Only Happen in JavaScript

Gabe Romualdo on December 15, 2019

JavaScript is a tricky language and can be very confusing in terms of how its code is parsed and run. It’s an object-oriented language, but for man...
Collapse
 
lampewebdev profile image
Michael "lampe" Lazarski

1) The right way todo conact arrays is array1.concat(array2). Plus does not mean concat in Javascript. In python this works withs lists. In Java this would also not work. Nothing strange in js.
2) Is correct and here it how the unary plus (+) works: developer.mozilla.org/en-US/docs/W.... Usually an error like this is shown by your editor :)
3) I would advise everybody to read the explination :)
4) This only happens in .html files if you try todo that in .js files you will get an error
5) Really nothing special to JS in Java for example MIN_VALUE float is 2-149. Just how signed float(numbers) in computer science usually work.

Collapse
 
brieucp profile image
brieucp

There are even JS to JSFUCK converter \o/
jsfuck.com/

Collapse
 
gaberomualdo profile image
Gabe Romualdo • Edited

Yup, that's how I made the code example :)

— Gabriel

Thread Thread
 
brieucp profile image
brieucp

I'm disappointed, I thought you wrote it manually ;)