Skip to main content

Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
TagsGame Engines

JavaScript Basics

A topic by Regal Games created Aug 29, 2022 Views: 223
Viewing posts 1 to 1
(1 edit) (+1)

JavaScript Basics

Variables

You can declare variables with the assignment operator (=). This is useful for containing data from an input and applying them with the Document Object Model. Constants work the same way. Declare a constant with the keyword "const" and use the assignment operator to set a value. Constants cannot be changed afterward, which should be self-explanatory.

Functions

You can declare a function to execute when a certain event happens, i.e. an "if" statement is true. You can run a console.log("Hello World")  to run when  this event unfolds.

User Inputs

You can add code to execute on an event, i.e. a click. These are typically used for buttons or for special effects. You can add the "onclick" attribute to an element to signify a function to be executed when it has been clicked.

More Info

Check out this Wikipedia page for more details. View this Wikipedia page for JavaScript syntax.

You should definitely search "JavaScript" for information, too!