
Arrays and Objects Basics
A variable can hold one value—and that value can be a collection holding many related values. JavaScript arrays and objects are how you build those…
Read tutorialOrganizing, accessing, transforming, and representing collections and structured data in JavaScript.
Tagged articles
16 articles in this tag.

A variable can hold one value—and that value can be a collection holding many related values. JavaScript arrays and objects are how you build those…
Read tutorial
You've learned arrays, conditionals, click events, and DOM updates as separate lessons. Now it's time to see them work together. A quiz app is the perfect…
Read tutorial
Every product you use has one: a search box that narrows a list as you type. Contact lists, product catalogs, dashboards, admin panels—they all use the…
Read tutorial
An image slider looks like a piece of fancy UI magic. Underneath, it is just a number moving through an array and telling the page which image to show.…
Read tutorial
Click a button. Watch the page change. That small moment—where your JavaScript stops just running and starts doing something visible—is the bridge between…
Read tutorial
Now you're stuck on a question that feels bigger than the error itself: do you change the const to let, or do you rewrite the line that's failing? The…
Read tutorial
You know how to build an array. Now comes the part where every beginner hits the same wall: you need to change the values, keep only some of them, or total…
Read tutorial
Three lines, three property reads, three variables. It works, and it is honest code. But then you see a modern codebase do the same job in one line, with…
Read tutorial
You log a value from an API or from localStorage, and it looks exactly like an object. You can see the keys. You can see the values. So you try to read a…
Read tutorial
You can loop over an array three different ways, and they all look nearly identical when you write them. So which one should you use?
Read tutorial
You copy a method into a new variable, call it, and get undefined instead of the name you expected. Nothing in the object changed. Nothing in the function…
Read tutorial
You have a list of tags with duplicates, or you want to count visits per user object, and your array or plain object starts fighting you. Here are the two…
Read tutorial
A to-do list is the first app where your page stops being a static document and starts remembering what the user does. Same event-listening idea as a click…
Read tutorial
You have probably already written code like this: a cartTotal here, a userName there, an isLoggedIn flag somewhere else. It works, right up until you…
Read tutorial
You finished the basics. You built a calculator, a to-do list, and maybe a number guessing game. The code runs. The buttons work. And now the map runs out.
Read tutorial
You have an array of names sitting in your JavaScript file. You want those names to show up as bullet points on the page. The naive approach is to write…
Read tutorial