The Console

Learn all about the Google Chrome Developer Tools Console and why it's hands-down one of the best tools to test your JavaScript code in the...

The Console

What is the console?

The browser console is the best way to test your JavaScript code on the fly. Not sure if your code will work? No worries, run it in the console first so you're not spinning your wheels, editing source code until you find a solution. Try it out before committing to it. Test your code without setting up a JavaScript environment. If you didn't know, the console is one of the developer's best friends.

Oh, and we're going to assume that you're using Google Chrome for all of your development stuff.

Getting started

There's a few different ways to open the console in your browser:

Right-Click > Inspect > Console
Settings > More Tools > Developer Tools > Console
Cmd + Option + I

Now what?

There's tons of cool things you can do with the console, but you might not know where to start. Copy the code example below, and paste it into your console. Try swapping out 'Coders' for your name to see what happens!

Paste this code snippet into your browser console

function welcome(name){
    console.log(`Welcome ${name}! Thanks for stopping by CodeSnippet!`);
welcome('Coders'); //try changing this to your name!

Help us improve our content