Javascript Data Types

 Data Types In JavaScript(Js)

Data types are used to classify one particular type of data in programming languages. For instance, a number and a string of characters are different types of data that will be treated differently by JavaScript.
This is important because the specific data type you use will determine what values you can assign to it and what you can do to it. This is to say, to be able to do operations with variables in JavaScript, it is important to understand the data type of any given variable.

JavaScript has different data types to hold different types of values.There are two types of data types in Js following below.

  • Primitive data type
  • Non-Primitive data type


1.Primitive Data type

  •        String:represents sequence of characters e.g. "myname"
  •        Number:represents numeric values e.g. 110
  •        Boolean:represents boolean value either false or true
  •        Undefined:represents undefined value
  •        Null:represents null i.e. no value at all
2.Non-Primitive Data type
  •      Object:represents instance through which we can access members
  •      Array:represents group of similar values
  •      RegExp:represents regular expression

  Ex.

        var a= 16;         // a is a number

        var a = "Tesla";   // a is a string

        var a= true;       // a is a Boolean

        var a;              // a is undefined

        





Comments

Post a Comment

Popular posts from this blog

JavaScript Introduction

Technology professional