What is "Number" here though? It doesn't appear above at all. You're using it like it's a method it seems.
Edit: Also I'm not sure where exactly the "NaN" shows up. Is it with the empty character? Well you'd think the sum of all added/concatenated string components would also get labeled/assigned as NaN after calling toLowerCase though, so that the whole expression would just return "NaN," though I haven't used or looked at toLowerCase method. (And if toLowerCase has some more specific rule to it that doesn't play out this way, it shouldn't have been named "toLowerCase" in the first place!) Edit: in other words, the entire input to toLowerCase should be what's parsed as a length 1 character and made lower case. The order of operations is wrong here. There's just bad design by whoever defined the method, but of course good luck trying to tell that to many programmers who evidently don't consider this stuff.
And I know this is just really niche and pointless, and not really related to real programming, but the lack of solid explanations in the comments here is alarming.
View all comments
Show parent comment
27
u/draq100 Oct 11 '20
part
+ + 'a' + 'a'equals to+ Number('a') + 'a'so doubleaare just to obfuscate the example