JavaScript Basic

 <!DOCTYPE html>

<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
<!--   ===========internal========-->

    <style>
        #div{
            height: 300px;
            width: 300px;
            background: red;
        }
    </style>
</head>
<body>

<div id="div"></div>
<button onclick="Test();">submit</button>
<script src="script.js"></script>

<script>
   // console.log(x);
  for(let i=0;i<=10;i++){
      console.log(i);
      document.writeln(`<h1>Number : ${i}</h1>`);
   }
  let j=0;
  while (j<=10){
      document.writeln(`<h1> J Number : ${j}</h1>`);
      j++;
  }




  let a=['red','green','blue']



  a.forEach(function(v,i){
    console.log(v);
  });

  a.map(function(v,i){
    console.log(v);
  })

  for(let i=0;i<a.length;i++){
    console.log(a[i]);
  }
 
  for(let abc of a){
       document.writeln(`<h1>Color: ${abc}</h1>`)
   }

   let data=[
       {
           name:"sabir",
           roll:1001,
       },
       {
           name:"Tejas",
           roll:1002,
       },

       {
           name:"Prem",
           roll:1004,
       }
   ]

   for(let stds of data){
       for(let s in stds){
           console.log(`key ${s} value ${stds[s]}`);
       }
   }

    // for(let i=0;i<a.length;i++){
    //     document.writeln(`<h1>Color: ${a[i]}</h1>`)
    // }

</script>
</body>
</html>

Comments

Popular posts from this blog

App 1st User Define Component

Example 1

Rabiit