1

I am checking below expressions console.log(2+'2') // 22 console.log(2-'2') // 0

why not came 2+'2' is 4 ,the above both two expressions are using arithmetic operators???

please guide me

Manesh
  • 43
  • 6
  • Good luck brother – Zakaria Acharki Jul 16 '18 at 09:14
  • Because [*"the addition operator produces the sum of numeric operands or string concatenation."*](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Arithmetic_Operators#Addition). The other arithmetic operands are defined only for numbers and they convert their operands to numbers before using them. – axiac Jul 16 '18 at 09:24

0 Answers0