0Pricing
Javascript for Kids · Lesson

Two Numbers

Store the inputs.

Two Numbers is a free Javascript for Kids lesson on CoddyKit — lesson 1 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.

Let Us Build a Calculator! 🧮

A calculator takes TWO numbers and does math on them! Like a tiny robot that loves arithmetic. 🤖➕

First step: we need to STORE our two numbers. Let us go!

Boxes for Numbers 📦

In JavaScript, we store values in variables. Think of them as labeled boxes! 📦

We make one with let, a name, and a value.

let a = 5
console.log(a)

Two Boxes 📦📦

A calculator needs TWO numbers. Let us make two boxes: a and b.

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

Name Them Nicely 🏷️

We can give boxes clear names too! Like firstNumber and secondNumber.

let firstNumber = 8
let secondNumber = 2
console.log(firstNumber)
console.log(secondNumber)

Show Both Together 👀

Let us announce our two numbers in one friendly message!

let a = 5
let b = 3
console.log('First number: ' + a)
console.log('Second number: ' + b)

Change a Number 🔄

We can change what is in a box any time! Just use the name and =.

let a = 5
console.log(a)
a = 10
console.log(a)

Numbers, Not Words 🔢

For math, store NUMBERS (no quotes). 5 is a number, but '5' with quotes is a word!

Watch the difference.

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

Quotes Trap! 🪤

Uh oh! If numbers have quotes, + glues them like words instead of adding! See what happens.

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

Big Numbers Welcome 💯

Your calculator can hold any numbers, big or small!

let a = 100
let b = 250
console.log('We will use ' + a + ' and ' + b)

Set Up the Calculator ⚙️

Let us set up our two numbers and get ready for math next lesson!

let a = 12
let b = 4
console.log('Calculator ready!')
console.log('a = ' + a + ', b = ' + b)

Your Turn to Store 🌟

Change a and b to YOUR favorite numbers and run it! 🔢

let a = 7
let b = 6
console.log('a = ' + a)
console.log('b = ' + b)

Quick Check ✅

Number-storing brain check! 🧠

Two Numbers Recap 🎉

Great start! 🧮 You set up your calculator's numbers.

  • Store values in variables with let
  • Use NUMBERS (no quotes) for math
  • You can change a box any time with =

Next: doing the actual MATH! ➕➖✖️➗

Frequently asked questions

Is the “Two Numbers” lesson free?

Yes — the full text of “Two Numbers” 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 “Two Numbers”?

Store the inputs. 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 1 of 4, so you can start here or from the beginning and move at your own pace.

How long does the “Two Numbers” 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