Data type:- JavaScript


  • JavaScript variables can hold many data types: numbers, strings, objects and more.
  • In programming, data types is an important concept.
  • To be able to operate on variables, it is important to know something about the type.
          
  •   code:- 

  • <!DOCTYPE html> 
    <html> 

    <head> 
     <meta name="viewport" content="width=device-width, initial-scale=1"> 
    </head> 

    <body> 

     <h1>Datatypes and reading</h1> 

     <input type="button" onclick="cal_dt();" value="Data Types"> 

     <div id="d1"></div> 
     <div id="d2"></div> 
     <div id="d3"></div> 
     <div id="d4"></div> 


     <script> 
      function cal_dt() 
      { 
       var num = 1200; //Number 
       var str = "Sample Program"; //String 
       var ar = ["banna", "orange", "apple"]; //Array 
       var obj = { 
        city: "nagercoil", 
        place: "mulagumoodu", 
        country: "India" 
       }; //Objects 

       document.getElementById('d1').innerHTML = num; 
       document.getElementById('d2').innerHTML = str; 

       document.getElementById('d3').innerHTML = ar[0] + "," + ar[1] + "," + ar[2]; 
       document.getElementById('d4').innerHTML = obj.city + "," + obj.place + "," + obj.country; 

      } 
     </script> 

    </body> 

    </html>
  • Data type:- JavaScript Data type:- JavaScript Reviewed by Network security on June 01, 2019 Rating: 5

    No comments:

    Useful Information

    Powered by Blogger.