HTML and CSS Reference
Figure 7-10: Logging an object to the console.
NOTE console.log isn't supported on all browsers, and on some older browsers it's available only
when developer tools are enabled. It can slow down your game if you call it frequently, so make sure you re-
move any calls before publishing your game.
jects while your game runs.
function to your game, you can use it from the console. This is useful for things such as turning on a developer
mode, adding health to make your game easier to test, and jumping to arbitrary points in your game. Using Alien
Invasion as an example, you can test starting the game or showing the “you lose” screen which normally plays