Anton Kovalyov
1 min readAug 6, 2015

--

…and (+””) equals zero…

In the parent post, someone asked: ‘What is this (+””)?’

How does this work? The unary plus operator tries to convert its operand to a number. An empty string is a falsey value in JavaScript so it converts it to 0. For more information on type conversion in JavaScript, I recommend Dave Herman’s Effective JavaScript.

--

--