GameSpark/Tutorials ← All tutorials
Tutorials

JavaScript

The coding basics behind every game: variables, loops, functions, and more.

1

What is a variable?

A named box that remembers a value you can change.

2

Numbers

Counting, positions, and arithmetic with + - * /.

3

Strings

Text, joining with +, and turning numbers into text.

4

Strings: more

length, upper/lower case, includes, and split.

5

Booleans

true / false, comparisons, and yes-or-no facts.

6

If statements

Make decisions with if, else, and else if.

7

Loops

Repeat work with for and while.

8

Functions

Package code you reuse, with parameters and return values.

9

Arrays

Hold many things — bullets, enemies, tiles — in one list.

10

Arrays: more power

forEach, map, and filter — do things to a whole list at once.

11

Objects

Group related values (x, y, speed) into one thing.

12

Import and export

Split a game across files and share code between them.