JavaScript: How to use the conditional ternary operator

In addition to “normal” comparison operators (see the links below), JavaScript has a unique comparison operator that can assign values rather than just return a boolean true or false. This is called the “Conditional (Ternary) Operator”.  It follows this syntactical construction: variablename = (condition) ? value1 : value2 The question mark means: If the condition … Continue reading JavaScript: How to use the conditional ternary operator

JavaScript: How to use NPM to install packages

NPM or “npm” stands for Node Package Manager. It is the default package manager for the JavaScript runtime environment Node.js. The NPM program is installed on your computer when you install Node.js. The website npmjs.com contains hundreds of thousands of free open source code packages that can be downloaded and used via npm. Downloading Individual … Continue reading JavaScript: How to use NPM to install packages

JavaScript: Intro to Web Game Development – Part 7: add title screen and settings

As of the previous article, the game can be considered to be in a “complete” state, but I want to add a few features, such as a title screen, some options such as score to win, ball speed, and game colors. I also want to add a link back to the title screen from the … Continue reading JavaScript: Intro to Web Game Development – Part 7: add title screen and settings

JavaScript: Intro to Web Game Development – Part 6: add win screen and replay

In the previous article, scoring was introduced, but there was no win detection that would end the game. The previous article in the series can be read here: JavaScript: Intro to Web Game Development – Part 5: ball handling, scoring, and A.I. In this article, I will show how to detect when a game ends … Continue reading JavaScript: Intro to Web Game Development – Part 6: add win screen and replay