// CLASS TOPICS : ARRAY DATA TYPE
// myList = [10,15,20,-1];
// array is defined by using symbol []
// console.log(myList)
// how data is stored in a array
// myList = [1,2,3,4,5];
//[0index -> 1, 1-> 2,2 index -> 3 ]
// myValue = myList[1]
// using [] and entering a index b/w []. we can get the value which is stored at that particular index
// console.log(myValue);
// CLASS TOPICS : SPREAD OPERATORS // we cannot sum two array like // array1 = [1,2,3,4,5] // array2 = [6,7,8] // array3 = array1 + array2 // console.log(typeof(array3)); // we will get type string instead of a new array // using spread opearators // array1 = [1,2,3,4,5] // array2 = [6,7,8] // array3 = [...array1,...array2] // console.log(array3) // we can sum up two arrays [...] then array name like array1 and then again ...array2 // to sum up and get a new array with elements of both arrays // using spread operator on object // obj1 = {name:"shagun",age:23} // obj2 = {gender:"male",name:"xyz"} // obj3 = {...obj1,...obj2} // console.log(obj3) // here the only diff is that those properties which are same will get //updated because we cannot have two key
Comments
Post a Comment