// 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 : Object DATA TYPE // myValue = {name:"shagun", age:23,email:"info@codesikho.com"} // console.log(myValue); // object is written using {} symbol // we will write our key:value pair between {} separated by , // value maybe a string , array or a object or maybe a number // HOW TO ACCESS VALUES? // myValue = {name:"shagun", age:23,email:"info@codesikho.com"} // myKeyVal= myValue["email"] // myKeyVal = myValue.age // console.log(myKeyVal); // so we can access either entering key name between [] in a string format // or we can access using . and then key name // we cannot write value with same key otherwise it will get override // myValue = {name:"shagun",name:"abc"} // console.log(myValue.name);
Comments
Post a Comment