Please enable JavaScript to use CodeHS

JavaScript

JavaScript is the most commonly used programming language for building websites! You can also use it to build games, mobile apps, and more!


Variables

Variables are like a box that can hold values. The steps to using variables are to first define it to a certain type such as Boolean, string, or integer and using suggested naming conventions. Secondly, variables must be initialized to a start value, and to assign it to a variable type. You use the var to declare a variable.

Functions and Return Values

Think of a function like assigning a task. A return value is giving you the completed work. This allows you to write functions that do some work for you and send back the result. Parameters are like inputs into the function, and the return value is output.

Graphics

The basics of creating graphics objects to a screen relies on setting the type, shape, size, position, and color before on the artist’s canvas before adding to the screen. Using the geometric concepts, and the concept of getWidth() and getHeight(), multiple graphic objects can be created in JavaScript.


Check out some other programs

Breakout
Helicopter
Game of Life

Play around with the code

JavaScript is the most commonly used programming language for building websites. It's a professional programming language that is very versatile.

Excited to start building your own JavaScript Program?