Search results
The MDN Web Docs site provides information about Open Web technologies including HTML, CSS, and APIs for both Web sites and progressive web apps.
- Learn Web Development
Welcome to the MDN learning area. This set of articles aims...
- Play
The MDN Web Docs site provides information about Open Web...
- Blog
The MDN blog publishes web development news, tutorials, and...
- HTML
HTML (HyperText Markup Language) is the most basic building...
- Advertise With US
The MDN Web Docs site provides information about Open Web...
- CSS
Cascading Style Sheets (CSS) is a stylesheet language used...
- About
MDN Web Docs is an open-source, collaborative project...
- Performance API
The following interfaces are present in the Performance API:...
- Learn Web Development
Jul 19, 2023 · MDN Web Docs is an open-source project and accepts contributions. There are many different tasks you can help with, from the simple (proofreading and correcting typos) to the complex (writing API documentation).
Feb 24, 2023 · Getting started with MDN Web Docs. We are an open community of developers, technical writers, and learners building resources for a better Web, regardless of brand, browser, or platform. Anyone can contribute, and each person who does contribute makes us stronger.
MDN Web Docs is an open-source, collaborative project documenting Web platform technologies, including CSS, HTML, JavaScript, and Web APIs. We also provide an extensive set of learning resources for beginning developers and students.
- Overview
- Syntax
- Logging objects
- Browser compatibility
- See also
The console.log() static method outputs a message to the console. The message may be a single string (with optional substitution values), or it may be any one or more JavaScript objects.
Parameters
obj1 … objN A list of JavaScript objects to output. Objects are output in the order listed. Please be warned that if you log objects in the latest versions of Chrome and Firefox, what you get logged on the console is a reference to the object, which is not necessarily the 'value' of the object at the moment in time you call console.log(), but it is the value of the object at the moment you open the console. msg A JavaScript string containing zero or more substitution strings. subst1 … substN JavaScript objects with which to replace substitution strings within msg. This gives you additional control over the format of the output. See Outputting text to the console in the documentation of console for details.
Return value
None (undefined).
Information about an object is lazily retrieved. This means that the log message shows the content of an object at the time when it's first viewed, not when it was logged. For example:
This will output {}. However, if you expand the object's details, you will see prop: 123.
If you are going to mutate your object and you want to prevent the logged information from being updated, you can deep-clone the object before logging it. A common way is to JSON.stringify() and then JSON.parse() it:
There are other alternatives that work in browsers, such as structuredClone(), which are more effective at cloning different types of objects.
BCD tables only load in the browser with JavaScript enabled. Enable JavaScript to view data.
•Microsoft Edge's documentation for console.log()
•Node.JS documentation for console.log()
Aug 18, 2016 · Signing in to MDN. Whenever you wish to make changes to MDN's content (such as editing, creating, or adding tags to pages), you need to be signed in. This article will explain the process of signing in and the authentication methods we support for identifying you as an MDN contributor.
People also ask
What is MDN Web Docs?
What can I do with MDN Web Docs?
Does MDN Web Docs have a learning area?
What does MDN do?
Jun 11, 2020 · The MDN Web Docs Learning Area teaches fundamentals of modern web development, beginning with HTML, CSS, and JavaScript essentials. In feedback this year, readers asked for a more opinionated, structured ...