Spelchan.com Logo

From Scratch Web Games: A Beginners Guide to Game Development using HTML, CSS, and JavaScript

Chapter 4.1: JavaScript Basics Cheat Sheet

JavaScript is the programming language that is a standard part of browsers. While there have been several attempts of having additional languages, most attempts have failed. One arguable exception to this is TypeScript, which has a large following but unfortunately requires compiling into JavaScript before it can be used.

The purpose of the cheat sheet is to give you a summary of the main aspects of the JavaScript language, with classes and asynchronous work being in separate cheat sheets. If you fully understand what is in the cheat cheat then feel free to skim or skip this chapter. I urge those readers to attempt the project just to make sure they really do understand the material but that is up to you.

The cheat sheet is here and the source in my github repository located at https://github.com/BillySpelchan/FromScratchHTML_CSS_JS.

Chapter contents

Chapter 4 Contents

4.1 Cheat Sheets

A quick summary of the basics of JavaScript.

4.2 History of JavaScript

A brief look at how JavaScript was written in 10 days.

4.3 Comment Controversy

Comments. Why programmers don't write them, and how they should be written

4.4 Variables

Variables are used to store the state of a program.

4.5 (extra) How Computers Represent Data

Bits, Bytes, and data types.

4.6 Math

Math on the computer similar but some symbol differences.

Math functions

Various math operations can be used through the Math class.

4.8 Strings

Strings are what we call blocks of text and are used extensively.

4.9 Calculating true and false

Determining if a conditional expression is true or false

4.10 if (Conditional statements)

Conditional code using the if statement.

4.11 Nested conditions

If statements can contain other if statements, this is called nesting.

4.12 Switch statement

Switch statements are a way of replacing large number of else if statements.

4.13 Functions

Functions let you put common code into a named function that can be called anywhere.

4.14 Looping

Loops allow you to repeat sections of code until conditions are met.

4.15 Nested loops

Just like conditional statements, loops can be nested but this has some special considerations.

4.16 Accessing the Web page

Scripting languages give us the ability to dynamically change the web page.

4.17 Events

Reacting to the user actions is done by handling events.

4.18 Project: Where’s Wendy

Our project for this chapter is a grid search game.

4.19 Project: Where’s Wendy implementation

My solution to the Project.

← previous section
Chapter contents
next section →
History of JavaScript
Table of Contents