// 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 : STRING DATA TYPE // "H" , "E" , "L", "O" // string is a combination of few characters // we can re-assign variables as done below // myValue = 'hello' // console.log(myValue, 'called') // myValue = 1 // console.log(myValue, 'called 2') // myValue = [1,2,3] // console.log(myValue,'called 3') // we can access charac from string same as we can do with array's // myValue = "hello" // myCharac = myValue[2] // console.log(myCharac); // we can create space b/w charac too // myValue = "hello " + "world" // console.log(myValue) // behind the scenes space is also being stored like this: ["h","e","l","l","o",""] // we can use \n to print data in next line // myValue = "hello my name is: \n shagun" // console.log(myValue); // we can also use \t to create space between words in the same line
Comments
Post a Comment