Javascript Data Types

Data type is a classification of data that tells the compiler or interpreter how the programmer intends to use the data. There are 7 data types available in JavaScript

  1. Number - Number represents variables whose value is either an integer or float. It can have numbers in the range between -(2^53-1) and (2^53-1).

  2. String - String represents textual data. The string contains elements that can be accessed using the index. The first element has an index of 0. Eg., "hello", "1234", "12here". You can access each element of string-like - str="HelloWorld", then str[1] will output 'e' on the console.

  3. Boolean - It represents a logical entity with values as true or false.

  4. Undefined - It represents a variable whose value is not yet assigned. It is sometimes mistaken with null but it is not the same as null.

  5. Null - It represents the intentional absence of value. When we do not know the value of anything then we can assign it a null value. It is different from undefined

  6. Symbol - It represents a unique value

  7. Object - It is represented by key-value pairs in javascript. In Javascript, everything is an object

0_-c09ZsTwbx0nlD6G.png