Grade 6
Functions: reusable recipes
Three lessons, then a test against Buggsy.
What you’ll learn
- A function is a named, reusable block of code:
function greet() { … }. Call it withgreet(). - Parameters are the placeholders in the definition; arguments are the real values you pass in.
returnsends a value back and stops the function. Noreturnmeans you getundefined.- Default parameters:
function greet(name = "friend") { … }. - Function expressions:
const add = function (a, b) { … }; - Arrow functions:
const add = (a, b) => a + b; - Functions are values: you can pass them into other functions (callbacks).
The lessons
- Declaring and calling Write code once, use it again and again.
- Return values Functions that give an answer back, and default parameters.
- Arrow functions and callbacks Shorter ways to write functions, and passing functions around.
Grade 7
Arrays: lists of things
Three lessons, then a test against Buggsy.
What you’ll learn
- An array is an ordered list:
const fruits = ["mango", "papaya"]; - Indexes start at 0:
fruits[0]. The last item isfruits[fruits.length - 1]orfruits.at(-1). push/popadd and remove at the end;unshift/shiftat the start.includes,indexOfandfindsearch;slicecopies a part;splicechanges the array.for…ofloops over items.splitturns a string into an array;joindoes the reverse.- Arrays are shared by reference: copy with
[...arr]. sort()sorts as text! For numbers usearr.sort((a, b) => a - b).
The lessons
- Lists and indexes Make lists, read items, and why we count from zero.
- Adding, removing and finding push, pop, shift, unshift, includes, indexOf, slice and splice.
- Looping, joining and sorting for…of, split and join, copying, sorting and lists inside lists.
Grade 8
Objects: describing things
Three lessons, then a test against Buggsy.
What you’ll learn
- An object groups related values as key: value pairs:
{ name: "Mia", age: 12 }. - Read with dot notation
user.nameor bracketsuser["name"](brackets work with variables). - Add or change with
=; remove withdelete; check with"key" in obj. - A method is a function inside an object.
thismeans “the object before the dot”. - Arrays of objects are how most real data looks.
for…in,Object.keys,Object.valuesandObject.entriesloop over objects.- Destructuring:
const { name, age } = user;. Objects are shared by reference: copy with{ ...obj }.
The lessons
- Keys and values Create objects, read and change their properties.
- Methods and nested data Functions inside objects, a first look at this, and arrays of objects.
- Looping, destructuring and copying for…in, Object.keys and entries, shortcuts, and the reference trap.
Class starts whenever you’re ready
Every lesson is free, there’s nothing to sign up for, and your progress saves as you go.