“As much as I’d love our code to be fully compliant with the great programming practices of this world, I’d rather have it working — if possible before the heat death of the Universe.”
No need to be that categorical in your judgement, your '' + 2 code sample has always been outdated, as String(2) or (2).toString() have been allowed since the 1997 standard (source).
It’s possible to do awful code in a lot of languages, Python included, finding the worst in a tech is not a proof of it “sucking” ;)
“As much as I’d love our code to be fully compliant with the great programming practices of this world, I’d rather have it working — if possible before the heat death of the Universe.”
Or as an alternative, String(x), which does exactly the same thing, except if x is null or undefined, then it produces 'null' or 'undefined' instead of throwing an error.
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Hmm... Good comparaison, JS is definitely getting better, but still.
Quick thougts:
Everything is an Object in JS (including arrays), there isn't any proper equivalent of python's magic functions (add for example).
One thing that horrifies me: how to convert a integer to string:
'' + 2
.I think JS' ecosystem is awesome, but JS in itself absolutely sucks. Pretty much the opposite of Python.
No need to be that categorical in your judgement, your
'' + 2
code sample has always been outdated, asString(2)
or(2).toString()
have been allowed since the 1997 standard (source).It’s possible to do awful code in a lot of languages, Python included, finding the worst in a tech is not a proof of it “sucking” ;)
There's a method for that:
Or as an alternative,
String(x)
, which does exactly the same thing, except ifx
is null or undefined, then it produces'null'
or'undefined'
instead of throwing an error.