- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
JavaScript console.log() with Example
The JavaScript console.log() method is used to write a message in the console.
Following is the code for JavaScript console.log() method −
Example
<!DOCTYPE html> <html> <head> <style> body { font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif; } </style> </head> <body> <h1>console.log() Example</h1> <button class="Btn">CLICK HERE</button> <h3>Click the above button to see output in your console</h3> <script> let test = { a:22, b:'HELLO', c:44, } console.log(test); console.log('HELLO WORLD'); </script> </body> </html>
Output
On clicking the “CLICK HERE” button −
- Related Articles
- Difference between console.dir and console.log in javascript?
- Getting console.log output from Firefox with Selenium.
- JavaScript getPrototypeOf with Example
- JavaScript JSON.stringify() with Example
- JavaScript unescape() with example
- Inheritance in JavaScript with example
- In JavaScript, can be use a new line in console.log?
- How do I console.log JavaScript variables as it relates to DOM?
- HTML DOM console.log() Method
- Getting console.log output from Chrome with Selenium Python API bindings.
- JavaScript Error and Exceptional Handling with Example
- Explain asynchronous functions in JavaScript with an example
- Difference between console.log and process.stdout.write in NodeJS
- JavaScript Numbers example
- JavaScript Prompt Example

Advertisements