DEV Community

Discussion on: JavaScript is a little weird!!

Collapse
 
matthewsalerno profile image
matthew-salerno • Edited

I agree that this is weird behavior, but I think (with the exception of the comma operator) this is pretty standard if you come from any other language.

Floating point operations lack base 10 accuracy no matter the language, increment has traditionally been a side efect-full operation on a variable. The only language I can think of that treats extra commas as empty (the 'expected' behavior) is Verilog (arguably not a coding language). And yeah I'll concede the comma operator thing is weird, I would expect it to create a list-like object or a syntax error.

That being said I think this is a fun look at why languages are weird in general, and it's certainly something we all had to learn at one point. Thanks for sharing!

Collapse
 
patarapolw profile image
Pacharapol Withayasakpunt

Floating point operations lack base 10 accuracy no matter the language,

Not all, but a lot.

Also, Python does have Decimal class.