Chapter 6

JavaScript

In this chapter

check An introduction to programming in the JavaScript Editor

check ‘Hello, World!’: Your first JavaScript program

check Programs for reading from button inputs, touch inputs, and the temperature, accelerometer, and compass sensors

check Fruit Catcher: A simple game to program and play on your BBC micro:bit

THE JAVASCRIPT LANGUAGE is a popular choice for beginners, with its easy-to-understand format and layout. It’s also one of the most common languages underpinning the World Wide Web. When you visit a web page and it has interactive content, that content is almost always powered by JavaScript. If you’ve previously worked through Chapter 5, ‘JavaScript Blocks’, then you’ve already had an introduction to how the language works: Programs created in the JavaScript Blocks Editor are invisibly transformed into JavaScript code as you build them, and it’s this code that is compiled and run on your BBC micro:bit or in the simulator. Technically speaking, the language used on the BBC micro:bit is a version of TypeScript on top of JavaScript, but this combination is most commonly ...

Get The Official BBC Micro:bit User Guide now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.