DEV Community

Discussion on: Today I answered a question which has been bothering me for a long time.

Collapse
mohsenalyafei profile image
Mohsen Alyafei

Nice.

Here is one :

a = 1 + "11";   // "111"
b = 1 +"11";    // "111"
c = 1 + +"11";  // 12

console.log(a)
console.log(b)
console.log(c)

If you place a "+" immediately before a String Number it will be converted to a Number Type.

Collapse
zunamidev profile image
zunami Author

Yeah, correct!