
JavaScript Arrays Explained for Beginners (With Simple Examples)
Hello readers 👋, this is the 4th blog of my JavaScript series. In this blog we will understand What is array?, Why do we need array? and some operations that we can perform on array. Imagine this: you are given a task to store the marks of students. How would you store the marks if arrays did not exist? Probably like this: let mark1 = 90 ; let mark2 = 87 ; let mark3 = 80 ; . . . let markn = 43 ; Now imagine this situation where you need to store 100s or 1000s of marks. How tedious task it would be. This is where arrays come into the picture. What is an Array? In JavaScript, an array is a single variable used to store an ordered collection or list of multiple values, which are accessed using numbered indexes starting at zero . To create an array we use square braces to store the values separated by comma. Example: let marks = [ 90 , 87 , 80 , 79 , 94 ] This single variable marks contains multiple values, and the values can be accessed using their index. In an array, each value can be ac
Continue reading on Dev.to JavaScript
Opens in a new tab


