5 hands-on exercises and 5 find-the-bug challenges for the JavaScript Arrays lesson. Every one is checked automatically in the browser — write the code, run it, and the tests tell you what still fails.
Create an array of three fruit names and show how many it holds.
Create an empty array and show its length.
Create an array holding a string, a number and a boolean, then show the type of the middle element.
Create a grid of two rows with three values each and show the length of the first row.
Push a value onto an array declared with const and show the new length.
The array was written without separators, so it holds one value instead of three.
Curly braces make an object, not an array, so there is no length.
Ready to write the code?
The editor, the automatic checks and the worked solutions open up with an account.
Open the workspacelength is a property, not a method.
The grid should hold rows, but every value was put in one list.
Building a new array loses the earlier values instead of adding to them.