minus-squareguy@lemmy.worldtoProgrammer Humor@lemmy.ml•Python is great, but stuff like this just drives me up the walllinkfedilinkarrow-up0·edit-26 months ago"1" + 2 === "12" is not unique to JS (sans the requirement for the third equals sign), it’s a common feature of multiple strongly typed languages. imho it’s fine. EDIT: I did some testing: What it works in: JS TS Java C# C++ Kotlin Groovy Scala PowerShell What produces a number, instead of a string: PHP SQL Perl VB Lua What it doesn’t work in: R C Go Swift Rust Python Pascal Ruby Objective C Julia Fortran Ada Dart D Elixir And MATLAB appears to produce 51, wtf idk linkfedilink
minus-squareguy@lemmy.worldtoMemes@lemmy.ml•Pulling it offlinkfedilinkarrow-up1·7 months agoThe sort of comeback so good you think of it later on and write a comic, wishing you’d said it at the time linkfedilink
"1" + 2 === "12"
is not unique to JS (sans the requirement for the third equals sign), it’s a common feature of multiple strongly typed languages. imho it’s fine.EDIT: I did some testing:
What it works in:
What produces a number, instead of a string:
What it doesn’t work in:
And MATLAB appears to produce 51, wtf idk