Heads up! To view this whole video, sign in with your Courses account or enroll in your free 7-day trial. Sign In Enroll
Start a free Courses trial
to watch this video
Learn basic concepts shared by all programming languages — values, variables, functions and control structures. Learn how changing values can change how a program works by experimenting with a JavaScript game.
Downloading and Running the Project Files
Because of how the Phaser.JS library handles files, you need to be running a web server locally to view a working copy of this project. You can't just open the index.html file in your web browser as you might a basic HTML page. There are several simple ways to get a web server up and running on your computer:
- Launch a local development server with the Live Server VS Code extension
- Launch a simple development http server with atom-live-server
Concepts
-
Syntax — a programming languages vocabulary and grammar. Every programming language has its own syntax. For example, JavaScript has special keywords like
var
,if
, andfunction
that all do different things to in a program. -
Values — the data in your program. For example, a number like
375
is a numeric value; a logical value liketrue
, orfalse
is called a boolean value; and a collection of letters inside of quote marks are called a string:'Hello there!'
. -
Variables — variables hold values. They are like boxes you store information in like the current score in a game, or the name of the player. For example, to create a variable and store a number 0 in it, you could write this JavaScript code:
var currentScore = 0
- Control structures — control the flow of the program: what happens and when it happens. For example, if you're playing a game and your character dies, the game ends. The flow of the program is controlled by actions that happen in the program.
- Commands (functions) — the commands we ask a program to complete, like adding two numbers together or validating a person's email address.
You need to sign up for Treehouse in order to download course files.
Sign up