Operators: Math, Comparisons & Logic

Doing things with values: adding, comparing, and combining. Eleven short pages from Grade 3 of Elementary School, about 14 minutes of reading in all.

What you’ll learn

  • Arithmetic: + - * / % **
  • Order of operations (yes, like math class)
  • Shortcuts like += and ++
  • Comparing values with <, >, >=, <=
  • Why === beats ==
  • Logic with AND, OR and NOT
  • The Math toolbox and random numbers
  • Two mini projects: a pizza calculator and a dice roller

The pages

Eleven pages, about 14 minutes.

  1. Arithmetic Operators: Math Class Is Back Don't run away! We promise this is the fun kind of math, where the computer does all the hard work and you just take…
  2. Order of Operations What's 2 + 3 * 4? If you said 20, Buggsy just got you. The answer is 14. JavaScript follows the same order of…
  3. Assignment Shortcuts In Grade 1, you learned to update a variable using its own value, like score = score + 10. This is so common that…
  4. Increment and Decrement: ++ and -- Adding or subtracting exactly one is so common (counting things, moving to the next item, losing a life in a game)…
  5. Comparison Operators Now for something new. Comparison operators compare two values and give you back a boolean: true or false. These are…
  6. Equality: Why === Beats == Here's a big one. JavaScript has two ways to check if things are equal. === is strict equality. It checks that both…
  7. Logical Operators: AND, OR, NOT Sometimes one question isn't enough. You need to combine several. To ride a rollercoaster, you need to be tall enough…
  8. The Math Object: A Calculator in Your Pocket JavaScript comes with a built-in toolbox called Math, packed with useful math functions. You use them by writing Math…
  9. Mini Project 1: The Pizza Party Calculator You're throwing a party. Each pizza has 8 slices, and each guest will eat 3 slices (realistically, more, but let's be…
  10. Mini Project 2: The Dice Roller Let's roll two dice, add them up, and check for doubles. Run this several times. You'll get different results each…
  11. Recap The key ideas of Grade 3, JavaScript operators, on one page. Arithmetic operators: +, -, , /, % (remainder), *…

Reading is step one

CurlyScript turns these notes into a game: short questions, an explanation after every answer, and a test at the end of each grade. Free, with nothing to sign up for.

Start learning