Data types define what information is stored
The most used of them are:
Type | Description | Example |
numeric | Whole number or floating point number. | let num1 = 5;
let num2 = 2.45; |
---|---|---|
string | Sequence of characters (text). | let text = 'JS is awesome!'; |
boolean | Can have only 2 values - true or false . |
let isAwesome = true; |
It's done using console.log
.
The variables are used to store data of certain type.
Their value can be changed any time.
Example of variables definitions:
Write a program in which variables are defined and printed.
Solution:
Output: