JavaScript Program on Array

Free Web development courses with real-time projects Start Now!!

Program 1

// Array 

// const array_name = [item1, item2, ...];  

// [] subscript
// const cityname=["Indore","Pune","Mumbai","Delhi"];
//                          // 0           1           2           3
//  let i
//  for(i=0;i<4;i++)
//  {
//     console.log(cityname[i]);
//  }
// const cityname=[];
// cityname[0]="Indore"
// cityname[1]=123
// cityname[2]="Mumbai"
// cityname[3]=12.34

// const cityname=["Indore",
//                           "Pune",
//                            "Mumbai",
//                            "Delhi"];

//         for(i=0;i<4;i++)
//         {
//              console.log(cityname[i]);
//         }

 //Array using New Key word                         
   const stname=new Array();
          
         for(i=0;i<stname.length;i++)
         {
              console.log(stname[i]);
         }

// Array as an Object
// const Student ={stname:"Vikas Sharma",stcourse:"BTech",stage:23,stbranch:"CSE"};
// console.log(Student.stname);
// console.log(Student.stbranch);

 

You give me 15 seconds I promise you best tutorials
Please share your happy experience on Google

follow dataflair on YouTube

Leave a Reply

Your email address will not be published. Required fields are marked *