for example in the indexOf
polyfill in MDN
fromIndex = +fromIndex || 0;
What does the +
in front of fromIndex
do?
for example in the indexOf
polyfill in MDN
fromIndex = +fromIndex || 0;
What does the +
in front of fromIndex
do?
Converts it into a number. It's the opposite of -fromIndex
, so it has to convert into a number.
+"0"
>> 0
+true
>> 1