+ 3

Why's the output of the code below NaN?

And why isn't it any longer NaN when changing the first plus sign into minus or deleting the first Boolean or the null? https://code.sololearn.com/WHuYhCTJLIW1/?ref=app

15th Apr 2018, 2:36 PM
Miro
Miro - avatar
1 ответ
+ 8
[]+false becomes a string and there isn't a - operation for strings so NaN. []-false converts false into a number to subtract. []-null converts null into a number to subtract. []+false+true string concatenates 'false' & 'true'.
15th Apr 2018, 3:00 PM
John Wells
John Wells - avatar