Yahoo Web Search

Search results

  1. developer.mozilla.org › enMDN Web Docs

    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:...

    • 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...

  2. 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 ...

  3. 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.

  4. 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. Together we can continue to drive innovation on the Web to serve the greater good.

  5. Outputting text to the console. The most frequently-used feature of the console is logging of text and other data. There are four categories of output you can generate, using the console.log(), console.info(), console.warn(), and console.error() methods.

  6. People also ask

  1. People also search for