Lesson 01 · Number systems
Same number.
Four outfits.
Binary, octal, decimal & hex — the way computers count, minus the headache.
Drops in
Dropping on TikTok & WasaaChat · bring a notebook
Try it · type in any card
All four are the same number. By Saturday night you'll read them all.
There are 10 kinds of people: those who get binary, and those who don't. Be the first kind.
Notes · coming soon
The written notes land here soon.
Worked examples, practice questions with answers, and everything from the video, written down. Lesson 01 drops Sat 10 Oct · 7 PM EAT on TikTok & WasaaChat.
Building with AI: how the cards work
The four cards at the top are about 60 lines of React. None of those lines do the conversion maths. JavaScript already reads every outfit, as long as you tell it which one with a prefix: 0b for binary, 0o for octal, 0x for hex, and none for decimal.
BigInt("0b101010") // 42n
BigInt("0o52") // 42n
BigInt("42") // 42n
BigInt("0x2A") // 42n
Going the other way, toString takes the base you want:
const n = 42n;
n.toString(2); // "101010"
n.toString(8); // "52"
n.toString(16); // "2a"
That's the whole converter. Each card knows its prefix. Only the card you type in is stored, and the other three are worked out from it, so the four can never disagree.
Why BigInt and not a normal number?
A normal JavaScript number is only exact up to . Past that, it quietly rounds:
Number("0b" + "1".repeat(64))
// 18446744073709552000 rounded!
BigInt("0b" + "1".repeat(64))
// 18446744073709551615n exact
Sixty-four 1s in binary is , which is 18,446,744,073,709,551,615. Paste 64 ones into the binary card and check.
Build your own with an AI assistant
Give it a prompt like this:
Build a React component with four text inputs: binary, octal, decimal and hex. Typing in any one updates the other three. Use BigInt so big numbers stay exact. If someone types a digit that doesn't belong in that base, show a friendly error instead of a wrong answer.
Then test what it gives you. Don't trust it until all three pass:
- Type
255in decimal. You should see11111111,377andFF. - Type
2in binary. You should get an error, not a number. - Paste 64 ones into binary. Decimal should read
18446744073709551615.
What does BigInt("0x1F") give?
Show answer
31n, because hex 1F is .
Practise more
- Khan Academy · Bits (binary digits) ↗ · practice questions
- Khan Academy · Hexadecimal numbers ↗ · practice questions
- Khan Academy · Patterns in binary numbers ↗ · video
- CS Unplugged · Binary numbers ↗ · activities, no computer needed
- Math is Fun · Binary, decimal and hexadecimal ↗ · worked examples