Saturday, March 3, 2018

Data types in javascript

These are the following data base in java script.

    1. Number          -  Integer and floating point can mentioned here.
    2. String             -  For String, may have one or more characters.
    3. Boolean          - True or false value can be mentioned here.
    4. Null                -  For unknown values null.
    5. Undefined      -  For unassigned value
    6. Object            -  For making data structure
    7. Symbol          -  For unique identifiers.

Example:

Below example explain all data types with the help of  typeof operator, 

typeof undefined // undefined

typeof 0 // number

typeof true // boolean

typeof "foo" // string

typeof Symbol("id") // symbol

typeof null // object

typeof alert // function

Note: typeof operator will tell you what it is, whether it is function, object or string etc.,







No comments:

Post a Comment