Professional Documents
Culture Documents
#3 - JavaScript Consolelog
#3 - JavaScript Consolelog
#3 - JavaScript Consolelog
log()
programiz.com/javascript/console
All modern browsers have a web console for debugging. The console.log() method is
used to write messages to these consoles. For example,
console.log() Syntax
Its syntax is:
console.log(message);
Note: We will be using the console.log() method to display the output in our upcoming
lessons.
// passing string
console.log("I love JS");
Output
I love JS
// storing values
const greet = 'Hello';
const name = 'Jack';
Output
1/2
Hello Jack
As you can see from these examples, console.log() makes it easier to see the value
inside a variable. That's why it's commonly used for testing/debugging code.
The console object also has various methods other than console.log(). To learn more,
visit JavaScript console.
2/2