Chapter 5
JavaScript Blocks
In this chapter
An introduction to programming in the JavaScript Blocks Editor
‘Hello, World!’: your first JavaScript Blocks program
Programs for reading from button inputs, touch inputs, and the temperature, accelerometer, and compass sensors
Fruit Catcher: a simple game to program and play on your BBC micro:bit
JAVASCRIPT BLOCKS IS a great entry into programming for younger readers and those without previous computing experience. Its visual environment makes it easy to see which parts of a program go together, and by dragging prewritten code blocks from the toolbox, mistakes are far harder to make than in traditional nonvisual programming environments.
In this chapter you’ll be introduced to the JavaScript Blocks Editor, powered by Microsoft MakeCode, and learn to write a series of programs that make the most of the BBC micro:bit’s capabilities. Finally, you’ll be able to make a quick-fire game in which you’re given the task of catching ever-faster falling fruits before they hit the ground.
Introducing the JavaScript Blocks Editor
The JavaScript Blocks ...
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.