and (+””) equals zero
Beautiful JavaScript
Anton Kovalyov

…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.

One clap, two clap, three clap, forty?

By clapping more or less, you can signal to us which stories really stand out.