A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://www.geeksforgeeks.org/javascript-console-log-method/ below:

JavaScript console.log() Method - GeeksforGeeks

JavaScript console.log() Method

Last Updated : 11 Jul, 2025

The console.log() method in JavaScript logs messages or data to the console.

The console.log() method is useful for debugging or testing purposes.

Syntax:
console.log("");
Parameters:

Any message either number, string, array object, etc. 

Return value:

It returns the value of the parameter given. 

Using Console.log()

Using the console.log() to print a string on the console.

JavaScript
console.log("Hello Geeks")

We can even print an array or an object on the console using log() method

Logging a Object and Array JavaScript
// Logging an Object
const myObject = {Skill1:"HTML", Skill2:"CSS"};
console.log(myObject);

// Logging an array
const myArray = ["HTML", "CSS", "JavaScript"];
console.log(myArray);

Output
{ Skill1: 'HTML', Skill2: 'CSS' }
[ 'HTML', 'CSS', 'JavaScript' ]
Supported Browsers:

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4