Number, String
Let’s find out the number and string in JavaScript.
Number
JavaScript recognize number without single or double quotes as number.
1 | alert(1); |
Use * for multiplication.
1 | alert(3 * 5); |
Use / for division.
1 | alert(10 / 2); |
string
Character must be enclosed in either ‘ or “.
1 | alert("hello !!"); |
Use + to connect character.
1 | alert("hello !!" + "my name is Ewan"); |