Search results
by Developers. Documenting web technologies, including CSS, HTML, and JavaScript, since 2005. MDN Web Docs has the most up-to-date and accurate information and the content is presented in an easy-to-understand manner.
- 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
Build it better. MDN Web Docs is an open-source,...
- Performance API
The following interfaces are present in the Performance API:...
- Learn Web Development
Mar 6, 2024 · 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: js. const obj = {}; console.log(obj); obj.prop = 123; 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 ...
- Outputting A Single Object
- Outputting Multiple Objects
- Using String Substitutions
- Styling Console Output
The simplest way to use the logging methods is to output a single object: The output looks something like this:
You can also output multiple objects by listing them when calling the logging method, like this: The output will look like this:
When passing a string to one of the console object's methods that accepts a string (such as console.log()), you may use these substitution strings: %o or %O 1. Outputs a JavaScript object. Clicking the object name opens more information about it in the inspector. %d or %i 1. Outputs an integer. Number formatting is supported, for example console.lo...
You can use the %cdirective to apply a CSS style to console output: The text before the directive will not be affected, but the text after the directive will be styled using the CSS declarations in the parameter. You may use %cmultiple times: The properties usable along with the %csyntax are as follows (at least, in Firefox — they may differ in oth...
Jun 1, 2017 · console.log prints the element in an HTML-like tree; console.dir prints the element in a JSON-like tree; Specifically, console.log gives special treatment to DOM elements, whereas console.dir does not. This is often useful when trying to see the full representation of the DOM JS object.
Jun 27, 2017 · Because log() is a static method of Math, you always use it as Math.log(), rather than as a method of a Math object you created (Math is not a constructor). If you need the natural log of 2 or 10, use the constants Math.LN2 or Math.LN10. If you need a logarithm to base 2 or 10, use Math.log2() or Math.log10(). If you need a logarithm to other ...
May 26, 2017 · In This Article. Sometimes, while debugging your Web app (or client-side code using Necko ), it can be useful to log HTTP traffic. This saves a log of HTTP-related information from your browser run into a file that you can examine (or upload to Bugzilla if a developer has asked you for a log).
People also ask
Why should I use MDN Web Docs?
What is MDN Web Docs?
Why do I need to log HTTP traffic?
How do I use log() in math?