I'm looking at the source code of the sum function of d3 and I'm wondering what the +
in line 8 and 10 does. It's this statement:
a = +array[i]
So it's an assignment of the ith element of array
to a
, but what does the +
in front of array[i]
do? The same syntax is repeated in line 10, where the +
precedes the function call. I have never seen such a syntax in JavaScript.