4represents textual data
7an integer or a floating-point number
1an integer with arbitrary precision
4Any of two values: true or false
7a data type whose variable is not initialized
2data type whose instances are unique and immutable
4key-value pairs of collection of data
Here, all data types except
4 are primitive data types, whereas
4 is non-primitive.
4 data type (non-primitive type) can store collections of data, whereas primitive data type can only store a single data.
Single quotes and double quotes are practically the same and you can use either of them.
Backticks are generally used when you need to include variables or expressions into a string. This is done by wrapping variables or expressions with
3 as shown above.
7 represents integer and floating numbers (decimals and exponentials). For example,
A number type can also be
7 (not a number). For example,
7 type can only represent numbers less than (253 - 1) and more than -(253 - 1). However, if you need to use a larger number than that, you can use the
1 data type.
1 number is created by appending n to the end of an integer. For example,
900719925124740999n Uncaught TypeError: Cannot mix BigInt and other types
This data type represents logical entities.
4 represents one of two values:
6. It is easier to think of it as a yes/no switch. For example,
7 data type represents value that is not assigned. If a variable is declared but the value is not assigned, then the value of that variable will be
7. For example,
It is also possible to explicitly assign a variable value
7. For example,
Note: It is recommended not to explicitly assign
7 to a variable. Usually,
9 is used to assign 'unknown' or 'empty' value to a variable.
9 is a special value that represents empty or unknown value. For example,
The code above suggests that the number variable is empty.
9 is not the same as NULL or Null.
A value having the data type
2 can be referred to as a symbol value.
2 is an immutable primitive value that is unique. For example,
Though value1 and value2 both contain
5, they are different as they are of the
6 is a complex data type that allows us to store collections of data. For example,
It also means that a variable can be of one data type and later it can be changed to another data type. For example,
To find the type of a variable, you can use the
7 operator. For example,
9 for the
How do you declare variables in types?