Course

JavaScript

Clicks, motion, and interactivity — bring your page to life.

Start learning

What is JavaScript?

JavaScript · Lesson 1 / 17

First steps4 lessons

  1. 01What is JavaScript?<script>alert()
  2. 02What is a variable?letconst
  3. 03Rewrite the text on the pagegetElementById()textContent
  4. 04Run code when a button is pressedaddEventListener()click

Your syntax toolbox5 lessons

  1. 05Check things with the consoleconsole.log()
  2. 06Let's do math with numbers+-*/
  3. 07If it's..., then: the if statementifelse===!==
  4. 08Let's play with randomnessMath.random()Math.floor()else if
  5. 09Make things happen on a timersetTimeout()setInterval()clearInterval()clearTimeout()

Grouping and repeating4 lessons

  1. 10Arrays: bundling many values together[]lengthpush()
  2. 11Let the computer do the repeating: the for statementforlength
  3. 12Functions: naming the things you dofunctionreturn
  4. 13Objects: bundling values under names{}length

Input and storage2 lessons

  1. 14Reading what someone typedvalueNumber()
  2. 15Making the browser remember: localStoragelocalStoragesetItem()getItem()

Working with outside data2 lessons

  1. 16JSON: the shape data travels inJSON.parse()JSON.stringify()
  2. 17fetch: bringing in outside datafetch()awaitresponse.json()