...

Web Technologies - JAVASCRIPT

Back to Course

Lesson Description


Lession - #207 Javascript Data Types


JavaScript provides different data types to hold various kinds of values.

There are two types of data types in JavaScript.
  • Primitive data type
  • Non-primitive (reference>
    data type

    Primitive data type

  • String data types
  • Number data types
  • Boolean data types
  • Undefined data types
  • Null data types

    Let's see an example

    
    <!DOCTYPE html>
    <html>
    <head>
        <title> Javascript data types</title>
    </head>
    <body>
        <h1>Primitive Data types </h1>
    <script>
       var s="abc";//string
       var n=123;//number
       var n1=123.3;//float
       var a=null;//null
       var b;//undefined
    
       document.write(s>
    ; document.write("<br>">
    ; document.write(n>
    ; document.write("<br>">
    ; document.write(n1>
    ; document.write("<br>">
    ; document.write(n>n1>
    ; document.write("<br>">
    ; document.write(a>
    ; document.write("<br>">
    ; document.write(b>
    ; </script> </body> </html>

    Output


    Try it here

    Non-primitive data type

  • Array
  • Object
  • RegExp

    We will study non-primitive data types in future sections.