How to learn JavaScript

Learning JavaScript means learning the language that makes web pages interactive: first HTML and basic CSS, then variables, numbers, strings, conditions, loops and functions, then working with the page itself. Four habits help most:

Two columns of source code in a dark editor with line numbers
A dark editor with two columns of code, the workspace for the MDN JavaScript exercises.Photo: Boskampi / Pixabay
  1. 1

    HTML and CSS first

    MDN lists them as prerequisites.

  2. 2

    Run it in the browser

    MDN suggests CodePen or JSFiddle.

  3. 3

    Learn to debug

    Read the error, then fix one thing.

  4. 4

    Build small games

    Like MDN's Guess the number.

Learn in Evernote. Clip the docs, let the AI Assistant fix your code, and search any snippet.

Start your coding notebook in Evernote

How to learn JavaScript in 6 steps

  1. 1

    Learn basic HTML and CSS

    MDN's JavaScript module expects you to know HTML and the basics of CSS first, because JavaScript works on web pages.

  2. 2

    Follow MDN's core JavaScript module

    It starts with what JavaScript is, a first practical game, troubleshooting, then variables, numbers and operators, and strings.

  3. 3

    Learn let and const

    Use let for values that change and const for values that do not. Reassign one in the console and read what it says.

  4. 4

    Practice in an online editor or the console

    If you cannot create files, MDN suggests an online editor such as CodePen or JSFiddle.

  5. 5

    Debug on purpose

    MDN's "What went wrong?" article teaches you to read errors. Break your code and fix it.

  6. 6

    Build a project each week

    A guessing game, a to-do list, a quiz. Add one new feature at a time.

A 4-week JavaScript plan

Following MDN's core modules, about 30 minutes a day
  1. 2Week 1What JavaScript is. Build the Guess the number game.
  2. 3Week 2Variables with let and const, numbers, operators and strings.
  3. 4Week 3Conditions, loops and functions in an online editor.
  4. 5Week 4Break the game on purpose and fix each error. Add a score counter.

Free coding practice log

One entry per session. Copy it, or save it to your Evernote account and keep your snippets in the same note.

Date: [day] · Time spent: [minutes]

Topic: [one concept, like for loops or functions]

Source: [tutorial, chapter or video, with its link]

What I built: [a small program, in one line]

Error I hit: [the last line of the error message]

How I fixed it: [one sentence, plus the corrected snippet]

Next session: [the next concept to learn]

Trusted by Millions Worldwide

4.4

2,100+ reviews on G2

4.4

8,200+ reviews on Capterra

4.4

73,000+ reviews on App Store

248M

Registered users

JavaScript learning questions

Can I learn JavaScript for free?

Yes. MDN Web Docs has a free, structured JavaScript course, and freeCodeCamp offers a free curriculum.

Should I learn HTML and CSS before JavaScript?

Yes. MDN's JavaScript module lists HTML and basic CSS as prerequisites.

What is the difference between let and const?

let declares a variable whose value can change; const declares one that cannot be reassigned.

Where can I run JavaScript?

In a web browser, or in an online editor such as CodePen or JSFiddle, which MDN suggests when you cannot create files.

How long does it take to learn JavaScript?

MDN's core module runs from What is JavaScript? through debugging and error handling, in the order listed. How long it takes depends on your schedule.

Is JavaScript the same as Java?

No. They are different languages with different uses, despite the similar names.

How to learn JavaScript with Evernote

Keep one notebook for JavaScript: the MDN pages you clip, your practice code, and every error you fixed.

  1. 1

    Clip the MDN module.

    Save the JavaScript first steps page with the Web Clipper. Keep it in a notebook called Learning JavaScript, with its code sample and link.

  2. 2

    Ask why the total fails.

    Put the loop and its TypeError in a note. Ask the AI Assistant why the total cannot change, and accept the fix from const to let.

  3. 3

    Find let again.

    Search for "let" when you need the syntax again. Evernote finds it in your MDN clip and in the practice note, code blocks included.

  • You can also ask the Assistant for a practice task that repeats every day.
  • You can also log your projects in a table, with a link to each one and what you learned.

Every snippet, error and fix in one place

Clip the docs you learn from, ask the AI Assistant why your code breaks, and find any snippet again by searching for it.

Start for free