The purpose of the expression in parentheses seems to be to return the current total value, or 0 if this is the first time the color is displayed. My question is that this right shift operator is overloaded, and I was looking for the wrong name, or why does the right shift behave this way?
(JavaScript ). , undefined >> 0 0, anyNumber >> 0 - anyNumber ( ). , undefined, >> 0 0. , 32 , >> 0 . ( , , 32 , wrapped, , , , .) , , ( , ).
:
if (colors[bgColor]) {
colors[bgColor] += nodeArea;
}
else {
colors[bgColor] = nodeArea;
}
... ( false >> 0 0), , NaN , nodeArea NaN non-number colors[bgColor] ({}, ), "" NaN.