← See all modules
Module 2Free

Programming basics

Variables, functions, conditions, lists, and clicks: the basics for understanding the code the AI writes.

5 lessons · 105 min

What you'll build

You don't need to become a programmer to use AI, but you do need to understand what it writes. In this module you learn the five ideas that show up in every app: values and variables, functions, conditions and loops, lists and objects, and clicks that change the page. All with examples you edit and run right here, seeing the result instantly.

  • Run code on the pageEvery idea comes with an example to edit, and the console shows what the code is doing.
  • What the projects useThe same patterns as the 3D game, the map app, and the AI app, only small.
  • 100% freeThe whole module is open, like the first one.

What you'll learn

  • Storing values in variables and showing them in the console
  • Writing functions that take data and return a result
  • Making decisions with if/else and repeating with for
  • Organizing data in lists and objects
  • Reacting to clicks and changing the page with JavaScript

The lessons

0 of 5 lessons complete
  1. 1Values and variables, the labeled boxesThe kinds of value that show up in every app, how to keep a value under a name, the difference between const and let, and how to build text.15 min
  2. 2Functions, the recipes of codeWhat a function is, how to pass data into it, what return does, and why the AI splits everything into functions.20 min
  3. 3Conditions and loops, deciding and repeatingHow code makes decisions with if and else, compares values, and repeats tasks with for without you copying anything.20 min
  4. 4Lists and objects, organizing the dataHow to keep several values in a list, describe one thing with an object, and go through a list of objects, the most common shape of data there is.25 min
  5. 5Events and the page, making clicks do thingsHow JavaScript finds an element on the page, changes its text, and reacts to clicks and to what the person types.25 min