JavaScript console.log() Method Last Updated : 02 Sep, 2025 Comments Improve Suggest changes Like Article Like Report In JavaScript, console.log() method is a built-in JavaScript function that outputs messages to the console, which is a special area in web browsers or runtime environments for developers to view information about their code. It is primarily used for:Debugging codeInspecting variablesTracking the flow of executionLogging errors or warnings Syntax:console.log("");message: The value, variable, or expression you want to print. Message can be a string, number, object, array, or any valid JavaScript expression.It returns the value of the parameter given. Using Console.log()The console.log() method is one of the most widely used debugging tools in JavaScript. It prints messages, variables, and expressions to the console, helping developers understand how their code is running. JavaScript console.log("Hello Geeks") OutputHello Geeks We can even print an array or an object on the console using log() methodLogging a Object and ArrayThe console.log() method can log not only strings and numbers but also complex data types like objects and arrays. This makes it especially useful when debugging applications.Logging an Object: When you log an object directly, the console shows it in an expandable format, so you can explore its properties: JavaScript let user = { name: "Alice", age: 25, city: "New York" }; console.log(user); Output{ name: "Alice", age: 25, city: "New York" }Logging an Array: Arrays can also be logged directly. The console shows them as a list of values with their index positions: JavaScript let fruits = ["Apple", "Banana", "Cherry"]; console.log(fruits); Output["Apple", "Banana", "Cherry"] Comment More info S Sakshi98 Follow Improve Article Tags : Misc JavaScript Web Technologies JavaScript-Methods Explore JavaScript BasicsIntroduction to JavaScript4 min readVariables and Datatypes in JavaScript6 min readJavaScript Operators5 min readControl Statements in JavaScript4 min readArray & StringJavaScript Arrays7 min readJavaScript Array Methods7 min readJavaScript Strings6 min readJavaScript String Methods9 min readFunction & ObjectFunctions in JavaScript5 min readJavaScript Function Expression3 min readFunction Overloading in JavaScript4 min readObjects in Javascript4 min readJavaScript Object Constructors4 min readOOPObject Oriented Programming in JavaScript3 min readClasses and Objects in JavaScript4 min readWhat Are Access Modifiers In JavaScript ?5 min readJavaScript Constructor Method7 min readAsynchronous JavaScriptAsynchronous JavaScript2 min readJavaScript Callbacks4 min readJavaScript Promise4 min readEvent Loop in JavaScript4 min readAsync and Await in JavaScript2 min readException HandlingJavascript Error and Exceptional Handling6 min readJavaScript Errors Throw and Try to Catch2 min readHow to create custom errors in JavaScript ?2 min readJavaScript TypeError - Invalid Array.prototype.sort argument1 min readDOMHTML DOM (Document Object Model)9 min readHow to select DOM Elements in JavaScript ?3 min readJavaScript Custom Events4 min readJavaScript addEventListener() with Examples9 min readAdvanced TopicsClosure in JavaScript4 min readJavaScript Hoisting6 min readJavascript Scope3 min readJavaScript Higher Order Functions7 min readDebugging in JavaScript4 min read Like