JS Interview - Unary Plus - Question 31

preview_player
Показать описание
This episode talks about what the result of any value after applying the unary plus operator to the operand.

Рекомендации по теме
Комментарии
Автор

I think it's strange that +"" converts to 0 because it is a falsey value, but +"hello" converts to NaN instead of 1, as "hello" is a truthy value.

RedEyedJedi
Автор

+{ } => NaN, +[ ] => 0 go figure

allezzthepunk