Console Log

In JavaScript, if we're testing our code and want to see the result, we can use the console.log function to print to our page.

Don't worry about what a function is, for now, all we need to know is that we can put the following code into our game.js file

When we open our index.html page in our browser, if we take a peek in the Console tab of our Dev Tools, we'll see the message printed out to us! This is a great way to see if your JavaScript files are connected (like how we added a coloured background to our CSS before we began styling), and also lets us test out JavaScript code in a playground setting.

results matching ""

    No results matching ""