You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// empty arrayvarlist=[];// array with stuffvarshoppingList=['apple','banana','orange'];varapple=shoppingList[0];varbanana=shoppingList[1];varorange=shoppingList[2];// array indexing starts from 0!// add stuff to the shopping listshoppingList.push('kiwi');console.log(shoppingList);// -> ['apple', 'banana', 'orange', 'kiwi']// remove stuff by indexshoppingList.splice(0,1);console.log(shoppingList);// -> ['banana', 'orange', 'kiwi']// change an element in the shopping listshoppingList[0]='mango';console.log(shoppingList);// -> ['mango', 'orange', 'kiwi']varlengthOfTheShoppingList=shoppingList.length;console.log(lengthOfTheShoppingList);// -> 3 !