JavaScript console.log() Examples

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


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

let name = 'John';
let age = 30;
console.log(`My name is ${name} and I am ${age} years old.`);

let name = 'John';
let age = 30;
console.log(name, age);

let numbers = [1, 2, 3, 4, 5];

let person = { name: 'John', age: 30 };
var str = "TL Dev Tech"; 

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

Leave a Comment

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

Scroll to Top

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.