5+5=? Converting values to a string or number in JavaScript
Let's analyze the example:
var a = 5; // number
var b = "5"; // string
var c = a + b;
alert(c); // 55
alert(typeof(c)) // string
When we add 5 and 5, we expect to see the output — 10. However, we get 55 and see that the data type is not a number, b...
ra1nbow1.hashnode.dev2 min read