JavaScript console.log() Examples

console.log() is a useful JavaScript method to print data into developer’s console.

//Syntax
console.log(x);

X can be of any data types, be it a string, or an inter, or an object. If the x doesn’t exist, it prints out error: Uncaught ReferenceError: x is not defined.

var str = "Tl Templates"; 
console.log(str); 

var brands = ['Honda', 'Huyndai', 'Toyota', 'BMW'];
console.log(brands); 
console.log(5+10);
console.log('He is ' + 15 + ' years old');

Leave a Comment

Your email address will not be published. Required fields are marked *

By continuing to use the site, you agree to the use of cookies. more information

The cookie settings on this website are set to "allow cookies" to give you the best browsing experience possible. If you continue to use this website without changing your cookie settings or you click "Accept" below then you are consenting to this.

Close