0Pricing
Javascript for Kids · Lesson

Doing Math

Add, subtract, multiply, divide.

Doing Math is a free Javascript for Kids lesson on CoddyKit — lesson 2 of 4. You can read the complete lesson below for free — then practise it hands-on in the browser with a built-in code editor and a 24/7 AI tutor. It is part of the Javascript for Kids learning path, one of 4 lessons in the course, and your progress syncs across the web and the CoddyKit app.

Time for Math! ➕➖✖️➗

Our calculator has two numbers stored. Now let us teach it to DO math!

JavaScript can add, subtract, multiply, and divide. Let us try them all! 🤖

Adding With + ➕

The + sign adds numbers together. Super simple!

let a = 5
let b = 3
console.log(a + b)

Subtracting With - ➖

The - sign takes away. Let us find the difference!

let a = 5
let b = 3
console.log(a - b)

Multiplying With * ✖️

For multiply we use a star * (not an x). Let us multiply!

let a = 5
let b = 3
console.log(a * b)

Dividing With / ➗

For divide we use a slash /. Let us share numbers equally!

let a = 6
let b = 3
console.log(a / b)

Label the Answers 🏷️

Let us show what each answer means with a friendly label!

let a = 8
let b = 2
console.log('Sum: ' + (a + b))
console.log('Difference: ' + (a - b))

All Four at Once! 🎉

Let us do every operation for the same two numbers!

let a = 12
let b = 4
console.log('Add: ' + (a + b))
console.log('Subtract: ' + (a - b))
console.log('Multiply: ' + (a * b))
console.log('Divide: ' + (a / b))

Why the Parentheses? 🤔

See those ( ) around a + b? They tell JavaScript to do the MATH first, THEN glue it to the words. Without them, things get silly!

let a = 5
let b = 3
console.log('Answer is ' + (a + b))

Save the Answer 💾

We can store an answer in a NEW box to use later!

let a = 10
let b = 5
let result = a + b
console.log('The result is ' + result)

Math Chain ⛓️

You can mix operations! JavaScript does * and / before + and -, just like in school.

let a = 2
let b = 3
console.log(a + b * 2)

Your Turn to Calculate 🌟

Change the numbers and try all four operations! Edit and run. 🧮

let a = 9
let b = 3
console.log(a + b)
console.log(a - b)
console.log(a * b)
console.log(a / b)

Quick Check ✅

Math operation brain check! 🧠

Doing Math Recap 🎉

You can do math now! 🧮 Your calculator knows:

  • + add, - subtract
  • * multiply, / divide
  • Use ( ) around math when joining with words

Next: letting the user PICK an operation with if! 🤔

Frequently asked questions

Is the “Doing Math” lesson free?

Yes — the full text of “Doing Math” is free to read here on the web, and the Javascript for Kids course includes 4 lessons in total. To practise it interactively (a built-in code editor and a 24/7 AI tutor) and unlock the rest of the Javascript for Kids course, upgrade to CoddyKit PRO.

What will I learn in “Doing Math”?

Add, subtract, multiply, divide. You practise Javascript for Kids with hands-on code you run directly in the browser, and a 24/7 AI tutor answers your questions as you work through the lesson.

Do I need any experience to start Javascript for Kids?

No prior experience is required. Javascript for Kids on CoddyKit is structured for beginners through advanced learners; this is — lesson 2 of 4, so you can start here or from the beginning and move at your own pace.

How long does the “Doing Math” lesson take?

Most CoddyKit lessons take about 5–10 minutes. Each one is bite-sized and interactive, so you make steady progress and pick up exactly where you left off across the web and the app.

Can I write and run code in this Javascript for Kids lesson?

Yes. Every Javascript for Kids lesson includes a built-in code editor, so you write and run real code right in your browser and get instant AI feedback — no local setup required.

All lessons in this course

  1. Two Numbers
  2. Doing Math
  3. Picking an Operation
  4. Showing the Answer
← Back to Javascript for Kids