The best way to learn to code is to build toward a goal. { Coding for Kids } is designed to get you there. This site hosts all the code for easy reference. To understand and learn about the code, you can purchase a copy of the book here.
Our goal in this book is to make a video game that lets you go from room to room in a house, finding and picking up items, and using them to fix things that are broken.
This starts off as a text adventure, and when you're ready, we adapt it for HTML to add colors, buttons, and images.
The game can even be adapted for other settings. Want to make a fantasy-themed game? A space station? A village? You can, and easily.
Check out the navigation bar for the pages you need.
The main site contains tutorials for many aspects of JavaScript. It's a detailed reference guide with examples to look at.
The code for The Room Adventure is also here. If you're stuck getting your code to work, you can check the code here to see what's up.
We cover a lot of ground in the book that will help you build the basics you need to create your own programs.
Note: The Room Adventure was written in JavaScript ECMAScript 5. The only difference that matters from the newer version, ECMAScript 6, is our use of the var keyword instead of the newer let keyword. For our purposes, there is no functional difference between the two.
[]
to round brackets ()
{}
to quotation marks ''
and ""
.
if
checks in your code.
else
block.
if/else
statements.
while
and for
loops.
max
and min
to control the numbers you need.