From Scratch to JavaScript

Knowledge Videos

Short animated explainers, organised by subject.

From Scratch to JavaScript

The same six ideas in blocks and in text: sequence, variable, condition, loop, function and event, plus what syntax and the console are.

Transcript

JavaScript is a programming language you write as text, and it is the language of web pages. The ideas are the same as in Scratch. Only the way you write them is different.

A sequence is lines that run from top to bottom. A variable is made with the word let. Let score equal zero, and later, score equals score plus one.

A condition is an if, with the test in round brackets. A loop is a for, and it counts how many times to repeat.

A function starts with the word function and a name, and you call it by name. An event handler runs when something happens, like a click.

Text code is strict. Brackets, quotes and semicolons must be exact. That spelling and punctuation is called syntax. When you make a mistake, the console shows an error message to help you find the bug.

Remember: JavaScript is a second language for the same six ideas. Syntax is its spelling rules, and the console shows the results and the errors.

More in this series