Today #day36 of #100daysofcode, I have completed 6.37 and 6.38 lessons and a code practice problems in JS course. @Sololearn
core objects
arrays
JavaScript Arrays
- Arrays store multiple values in a single variable.
- syntax:
var courses = new Array("HTML", "CSS", "JS");
- to access an array use the following syntax:
arrayname[arrayindex]
Note: - [0] is the first element in an array. [1] is the second. Array indexes start with 0.
- 1st element is 0th index. 10th element is 9th index.
- undefined value is returned when you access an index outside of the array.
other ways to create arrays
- you can first create an array and then you can add the elements by later the referencing the index number.
- An array is a special type of object. An array uses numbers to access its elements, and an object uses names to access its members. Note:
- JavaScript arrays are dynamic you can declare an array without an argument inside the
()
, you can add any number of elements dynamically later.
Images of lesson completed
Conclusion
- JavaScript Arrays
- creating arrays
- quiz
- code