let marks = [12,13,78,34,54,44,11];

let names = ["vikas","vishal","kiraa","raj"];

console.log(marks[1])
console.log(marks);
console.log(marks.length);

//modify value
marks[0]=89



let mixed = ["vikas",21,"M","Student",9123888348]

console.log(mixed)



//create the array in other way

let ages = new Array(4);


ages.push(5);

//add multiple elements
ages.push(11,45)

console.log(ages);

///////////////////////////////////////////
let ages2 = new Array(12,21,22);
console.log(ages2)



// access array through loop
for(mark of marks ){
    console.log(mark)
}

// or many methods or loops by length etc



///////////////////////////////////////////////////PRACTISE QUESTIONS/////////////////////////////////////////////////////

// AVG MARKS OF CLASS

let scores = [34,56,67,78,32,55]

let total =0;

for (score of scores){
    total+=score;
}
let avg = 
console.log("Average : ",total/scores.length);


//How to find a 10% discount of all elements in a JavaScript ...
let items = [230,568,450,100,200];
let finalPrice;
 let i=0;
for(item of items){
   
 finalPrice = item - (item * 10)/100 ;
    items[i]=finalPrice;
    i++;
}

console.log("After 10% discount : ",items);


/////////////    Array methods ///////////////////////////

//add element in array 
// push()
// pop()
// toString()


let foodItems = ["Dal" ,"Puri"]
let count = [23,3,21,3,34,3]

foodItems.push("Kheer")
console.log(foodItems)

//merge 2 arr
let mergeArr = foodItems.concat(count)

//merge multiple arr
// let mergeArr = foodItems.concat(count,arrName,Arrname)


//unShift() add element to start
//shift() delete from start

//slice(startIndexx,endIndex)  cut the array to range 
console.log(count.slice(0,3))


/// array of companies

let companies= ["Bloomberg","Uber","google","Mircrosfot"]

//remove first companiy
companies.shift();
// console.log(companies)

//remove uber and add ola
companies.splice(1,1,"Ola")  // remove element form index and add 1 elementto index 1

// add amazon at the end
companies.push("Amazon")
console.log(companies)
 








Embed on website

To embed this program on your website, copy the following code and paste it into your website's HTML: