
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 tutorialArticles assigned the beginner difficulty level in the authoritative article metadata.
Tagged articles
65 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
JavaScript arrow functions let you write the same functions you already know in fewer lines. The idea isn't new—only the syntax is shorter.
Read tutorial
You've learned how to store values in variables. Now it's time to make those values do something. JavaScript operators are the verbs of your code—they add,…
Read tutorial
There's a moment in learning JavaScript when things stop being abstract. You've studied variables and functions. You've followed along with examples. But…
Read tutorial
There is a small magic moment in every beginner programmer's life: the first time a page changes itself, with no click, no refresh, no input from you. The…
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
You have definitely seen a modal before. You clicked a button on a website, and a small window appeared on top of the page. Everything behind it went dark.…
Read tutorial
You've clicked buttons. You've added items to a list. Now it's time to make JavaScript think.
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
A calculator is not smart. It just remembers two numbers and one operator between clicks. Once you see that, the whole project becomes simple—and you will…
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
A static page is a finished product. A dynamic page is a conversation: the user clicks, submits, or types, and the page answers. That answer usually means…
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
A static HTML page is frozen the moment it loads. Real sites keep changing after that—a to-do item appears, a cart entry disappears, a new message slides…
Read tutorial
That is the worst kind of bug for a beginner, because the console gives you nothing to read. So you start adding console.log() lines, reloading, guessing,…
Read tutorial
You click a button, the page freezes for two seconds, and then either fills in with data or stays empty forever. The code might be fine. The problem is…
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
If you are new to JavaScript, this message can look like the browser is speaking a different language. It is not. It is telling you something simple: your…
Read tutorial
You wrote the addEventListener line. You clicked the button. Nothing happened. No error message. No reaction. Just silence.
Read tutorial
A function that always does the same thing is a dead end. A function that can accept input and hand back a result becomes a tool you can reuse anywhere.
Read tutorial
Your first projects probably felt instant. Click a button, the counter goes up. Type a task, it appears in the list. Every value was ready the moment you…
Read tutorial
You fill out a form, hit submit, and the whole page jumps. Everything you typed is gone. The browser did what forms do by default: it sent the data and…
Read tutorial
You have a button on your page. You want something to happen when someone clicks it. That moment—when a static page starts responding—is where JavaScript…
Read tutorial
You built a button. It looks great. You click it, and... nothing. The page just sits there, politely ignoring you.
Read tutorial
Copying and pasting the same code over and over works for a while—until you need to change something and suddenly have to hunt through ten copies of 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
A function can outlive the variables it was born next to. That sentence sounds wrong until you run it.
Read tutorial
You type new Date() into the console and get back a long string with a time zone name you never asked for. You type Date.now() and get a big number. Same…
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
The moment your script file gets long enough that you scroll to find a function, you have outgrown the single-file habit.
Read tutorial
A web page is three layers doing one job. HTML builds the structure, CSS styles it, and JavaScript makes it respond. This tutorial shows you how to add…
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 write a variable inside a function, log it, and it prints perfectly. You move that same console.log two lines down, outside the function, and suddenly…
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 log three things in the console. A variable you declared but never filled in. A property you hoped was on an object. A function call that was supposed…
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
That is the normal first experience with recursion. The function calls itself, the answer appears, and somewhere in the middle your mental model goes dark.…
Read tutorial
You start with a simple check. Does this input contain a dash? You reach for includes(). Then the input changes shape, and suddenly you have five if…
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
Two equals signs and three equals signs look like a typo. They are not. They are two different questions, and one of them lies to you politely.
Read tutorial
You have text in a variable. You want to check it, cut it, clean it, or change it. But which method does which—and what does each one give you back?
Read tutorial
A condition does not ask whether a value is true. It asks what that value becomes when JavaScript forces it into a yes-or-no decision.
Read tutorial
One bad line can take down everything after it. Here is how to catch that failure at the exact point it happens, and how to throw your own when a function…
Read tutorial
A button click is one quick signal. Typing is a stream of signals. Every search box, sign-up form, and chat input depends on JavaScript watching that…
Read tutorial
You already know how to declare a variable. You've probably written let score = 0 or const userName = "Alex" and moved on. But then you open an older…
Read tutorial
Five console.log statements will print five numbers. Fifty will print fifty. Five hundred will print five hundred—if you have the patience to write them…
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
Every program you write has to react to the world around it. A login form needs to say "Welcome back" to one person and "Invalid password" to another. A…
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 already know how to select an element and change what it says. Now let's make it change what it looks like.
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 learned how to select elements, change their content, update their styles, and create new elements from scratch. Each of those skills makes sense…
Read tutorial
You have read about getElementById, textContent, createElement, and remove(). You understand what they do on paper. But understanding a method and feeling…
Read tutorial
You can write an if/else statement. You know where the braces go and what console.log does. But when the condition gets even slightly tricky, you hesitate.…
Read tutorial
Reading about functions feels clear. Writing one from scratch feels different. That gap is normal—and it closes the same way for everyone: by running code,…
Read tutorial
A query string is the page's small, shareable memory: the part of the address that survives a copy-paste, a bookmark, or a link sent to a friend. Here is…
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
You built something that works. A button that counts clicks. A form that collects a name. A little app that feels alive in the browser. Then you hit…
Read tutorial
You cannot change an element you cannot reach. Every update, style change, and click response on a web page starts with one act of finding. JavaScript…
Read tutorial
textContent treats your value as plain text. innerHTML treats it as HTML markup. Same string, two different outcomes—and one of them needs extra care when…
Read tutorial
You have a button. You have a menu. You want the button to hide the menu, and you want it to show the menu again when clicked a second time. If your first…
Read tutorial
Every program you will ever write starts with the same move: storing information so you can use it later. A user's name, a score, a shopping cart total, a…
Read tutorial
Your HTML file is just text. It sits on disk, perfectly still, until a browser reads it. Yet the page you're looking at right now can change—text updates,…
Read tutorial
You learned to select one button and make it respond to a click. Then your page grew five buttons that all need the same behavior—and your trusty…
Read tutorial
A website is mostly text doing work: a signup form checking an email address, a search bar cleaning up what a user typed, a dashboard greeting someone by…
Read tutorial