JavaScript '+' operator can be used in many different ways. 🤯
let x = "3";
console.log(typeof x)
// expected output: "string"
console.log(3 + x);
// expected output: "33"
console.log(+x + 3);
// expected output: 6
console.log(3 + + x);
// expected output: 6
console.log(3+ +x);
// expected output: 6
console.log(x++);
// expected output: 3
console.log(x++);
// expected output: 4
console.log(++x);
// expected output: 6
console.log(x);
// expected output: 6
console.log(typeof x);
// expected output: "number"
Comment below if you have another interesting operation with '+' operator 😎
Top comments (0)