How to use console.log in Javascript
By Tan Lee Published on Dec 18, 2024 352
In JavaScript, console.log() is a built-in method used to print messages to the console, typically for debugging purposes.
What is a console.log?
console.log
is a function in JavaScript that allows you to output or display messages or values in the console of your web browser or integrated development environment (IDE). It is commonly used for debugging purposes to check variable values or log messages during program execution. You use it by passing the message or value you want to log as an argument to the function.
It allows you to output values, variables, and expressions to the browser's developer tools console.
Basic Syntax:
console.log(message);
message
can be a string, number, object, array, or any other JavaScript expression.
For example:
console.log("Hello, world!");
This will log "Hello, world!" in the console.
- How to use sweetalert2
- How to Pass string parameter in an onclick function
- How to format number with commas and decimal in Javascript
- What does 'use strict;' means in Javascript
- How to detect if caps lock is pressed in Javascript
- How to create a Custom Event in Javascript
- How to Check if an Object Has a Property Properly in JavaScript
- How to convert an Uint8Array to string in Javascript
Categories
Popular Posts
Structured Data using FoxLearn.JsonLd
Jun 20, 2025
Implement security headers for an ASP.NET Core
Jun 24, 2025
10 Common Mistakes ASP.NET Developers Should Avoid
Dec 16, 2024
Modular Admin Template
Nov 14, 2024
SB Admin Template
Nov 14, 2024