In js '+' operator used for
Example
12 +'12' // 1212 string
'abc' + 12 // 12abc string
'abc' + 12 for addition left and right should be numbers. But left side value is string. So convert 12 to String and then perform string concatenation
+'12' // Number('12') 12
+'abc' // Number('abc') NaN
+'12a'// Number('12a') NaN
Nothing is present in left side, so it will type cast '12' to number using Number()
12 +12 // 24
Both left and Right side are number, so simply perform addition
For any doubt, feel free to comment!!
May be JavaScript null, undefined, 0, empty string, NaN Are Not Same article give you more knowledge on type casting