
JavaScript has only one type of number. Numbers can be written with or without decimals.
*Adding Numbers and Strings
WARNING !!
JavaScript uses the + operator for both addition and concatenation.
Numbers are added. Strings are concatenated.
If you add two numbers, the result will be a number:
Example:
let x = 10;
let y = 20;
let z = x + y; // z will be 30 (a number)
If you add two strings, the result will be a string concatenation:
Example:
let x = “10”;
let y = “20”;
let z = x + y; // z will be 1020 (a string)