Learn Create Your Own Split Screen

Next Page

Scratch includes the ability to perform various mathematical operations, and so does Javascript. All the ones you're familiar with plus many more.

Scratch Javascript Meaning
+ addition
- subtraction
* multiplication
/ division
% remainder (modulus)


In Scratch, for multi-step equations, what happens first and what happens next (precedence) is controlled by how you put the blocks together.

In Javascript, it's controlled by the use of round brackets. For example:

var area = width * height; var thing = (2 + 3) * 5; // thing will equal 25 var other = 2 + (3 * 5); // other will equal 17