Simply put, a data type in simply the type of data. It could be a string (eg. a username), an integer number (eg. population of people) or a floating-point number (eg. a student's GPA) and more. Each data type has a set of operations that can be performed on them. Just as you divide a number by another number (eg. 30/12) but cannot divide a name by a name. An operation is only valid as it is allowed by the data type.
JavaScript is a loosely or weakly typed language. This is simply because the data type of a variable or constant in known by its value. The table below shows the data types:
JavaScript is a loosely or weakly typed language. This is simply because the data type of a variable or constant in known by its value. The table below shows the data types:
| JavaScript Data types | |
|---|---|
| 1. | string |
| 2. | number |
| 3. | function |
| 4. | boolean |
| 5. | null |
| 6. | undefined |