JavaScript Basics

A developer pulling the lever of a block press that stamps colorful shapes, with LET and CONST drawers and ARRAY, OBJECT, and FUNCTION bins.

Whether you’ve never written a line of code or you’re coming to JavaScript from another language, this is the place to start. These tutorials walk you through the essential building blocks: variables with let and const, strings and numbers, arrays and objects, conditionals and loops, and functions. Each idea comes with short examples you can run right in your browser’s developer console.

Free Bonus: JavaScript Cheat Sheet

JavaScript Cheat Sheet

Variables, arrays, objects, functions, and async basics in one printable reference.

Get the Free Cheat Sheet »

Once these basics feel natural, you’ll be able to read most everyday JavaScript and write small scripts of your own. From there, you can move on to asynchronous code, modules, and classes, or start building small projects that tie everything together.

Not Sure Where You Stand?

Take the JavaScript Skill Test to find out which level fits you best:

Take the Quiz: Test your knowledge with our interactive “JavaScript Skill Test” quiz. You’ll receive a score upon completion to help you track your learning progress:


Interactive Quiz

JavaScript Skill Test

Take this JavaScript quiz to test your skills from basic to expert level. Are you at the Basics, Intermediate, Advanced, or Expert level?

No. These tutorials are written for complete beginners and explain each concept from scratch. If you already know another language, you’ll move faster, but you won’t need any prior experience to follow along.

Nothing at first. Every modern browser includes a JavaScript engine and a developer console where you can type and run code. Later, you’ll want a code editor such as VS Code, and Node.js if you want to run JavaScript outside the browser.

Start with variables and data types, then move on to conditionals, loops, and functions. After that, learn arrays and objects, which you’ll use in almost every program. If you’re unsure where to begin, take the JavaScript Skill Test first.

If you want to build websites or web apps, start with JavaScript, since it’s the language browsers run. Java is a separate language used mostly for back-end systems and Android apps. Read Java vs JavaScript to see how the two compare.

When you can write small programs with variables, loops, functions, arrays, and objects without looking up the syntax every time, you’re ready. A good test is building a small project on your own, such as a to-do list or a number-guessing game.

Not sure where to start? Mentor AI can put these tutorials in an order that fits what you already know.