Data Types
Data Types
Eg:-
let message = "hello";
message = 123456;
Note:- JavaScript, are called “dynamically typed”,
meaning that there exist data types, but variables are not
bound to any of them.
NUMBER
• The number type represents both integer and floating point numbers.
• There are many operations for numbers, e.g. multiplication *, division /,
addition +, subtraction -, etc.,
• Besides regular numbers, there are so-called “special numeric values”
which also belong to this data type: Infinity, -Infinity and NaN.
• Infinity represents the mathematical Infinity ∞. It is a special value
that’s greater than any number.
• NaN represents a computational error.
• It is a result of an incorrect or an undefined mathematical operation
STRINGS
• A string in JavaScript must be surrounded by quotes.
Syntax:
let str = "Hello";
let str2 = 'Single quotes are ok too';
let phrase = `can embed another ${str}`;