The console object provides access to the debugging console (e.g., the Web console in Firefox). The specifics of how it works vary from browser to browser or server runtimes (Node.js, for example), but there is a de facto set of features that are typically provided.
The console object can be accessed from any global object. Window on browsing scopes and WorkerGlobalScope as specific variants in workers via the property console. It's exposed as Window.console, and can be referenced as console. For example:
Note: Certain online IDEs and editors may implement the console API differently than the browsers. As a result, certain functionality of the console API, such as the timer methods, may not be outputted in the console of online IDEs or editors. Always open your browser's DevTools console to see the logs as shown in this documentation.
Creates a new inline group, indenting all following output by another level. However, unlike console.group() this starts with the inline group collapsed requiring the use of a disclosure button to expand it. To move back out a level, call console.groupEnd().
The console's most frequently used feature is logging text and other data. There are several categories of output you can generate using the console.log(), console.info(), console.warn(), console.error(), or console.debug() methods. Each of these results in output styled differently in the log, and you can use the filtering controls provided by your browser to view only the kinds of output that interest you.
You can use nested groups to help organize your output by visually combining related material. To create a new nested block, call console.group(). The console.groupCollapsed() method is similar but creates the new block collapsed, requiring the use of a disclosure button to open it for reading.
You can start a timer to calculate the duration of a specific operation. To start one, call the console.time() method, giving it a name as the only parameter. To stop the timer, and to get the elapsed time in milliseconds, just call the console.timeEnd() method, again passing the timer's name as the parameter. Up to 10,000 timers can run simultaneously on a given page.
An admin account has privileges to manage services for other people in your organization. The Admin console is only available when you're signed in to an admin account. If you don't have access to an admin account, get help from someone else who does. For details, see Who is my administrator?.
Warning: The global console object's methods are neither consistentlysynchronous like the browser APIs they resemble, nor are they consistentlyasynchronous like all other Node.js streams. See the note on process I/O formore information.
The Console class can be used to create a simple logger with configurableoutput streams and can be accessed using either require('node:console').Consoleor console.Console (or their destructured counterparts):
console.assert() writes a message if value is falsy or omitted. It onlywrites a message and does not otherwise affect execution. The output alwaysstarts with "Assertion failed". If provided, message is formatted usingutil.format().
The specific operation of console.clear() can vary across operating systemsand terminal types. For most Linux operating systems, console.clear()operates similarly to the clear shell command. On Windows, console.clear()will clear only the output in the current terminal viewport for the Node.jsbinary.
Starts a timer that can be used to compute the duration of an operation. Timersare identified by a unique label. Use the same label when callingconsole.timeEnd() to stop the timer and output the elapsed time insuitable time units to stdout. For example, if the elapsedtime is 3869ms, console.timeEnd() displays "3.869s".
This method does not display anything unless used in the inspector. Theconsole.profile() method starts a JavaScript CPU profile with an optionallabel until console.profileEnd() is called. The profile is then added tothe Profile panel of the inspector.
This method does not display anything unless used in the inspector. Stops thecurrent JavaScript CPU profiling session if one has been started and printsthe report to the Profiles panel of the inspector. Seeconsole.profile() for an example.
For historical web-compatibility reasons, the namespace object for console must have asits [[Prototype]] an empty object, created as if by ObjectCreate(%ObjectPrototype%), instead of %ObjectPrototype%.
A group is an implementation-specific, potentially-interactive viewfor output produced by calls to Printer, with one further level of indentationthan its parent. Each console namespace object has an associated group stack, whichis a stack, initially empty. Only the last group in a group stack will hostoutput produced by calls to Printer.
The logger operation accepts a log level and a list of other arguments. Its main output is theimplementation-defined side effect of printing the result to the console. This specificationdescribes how it processes format specifiers while doing so.
If the console is not open when the printer operation is called, implementations should buffermessages to show them in the future up to an implementation-chosen limit (typically on the order ofat least 100).
Each console function uses a unique value for the logLevel parameter when callingPrinter, allowing implementations to customize each printed message depending on the function fromwhich it originated. However, it is common practice to group together certain functions and treattheir output similarly, in four broad categories. This table summarizes these common groupings:
A video game console is an electronic device that outputs a video signal or image to display a video game that can be played with a game controller. These may be home consoles, which are generally placed in a permanent location connected to a television or other display devices and controlled with a separate game controller, or handheld consoles, which include their own display unit and controller functions built into the unit and which can be played anywhere. Hybrid consoles combine elements of both home and handheld consoles.
Video game consoles are a specialized form of a home computer geared towards video game playing, designed with affordability and accessibility to the general public in mind, but lacking in raw computing power and customization. Simplicity is achieved in part through the use of game cartridges or other simplified methods of distribution, easing the effort of launching a game. However, this leads to ubiquitous proprietary formats that create competition for market share.[1] More recent consoles have shown further confluence with home computers, making it easy for developers to release games on multiple platforms. Further, modern consoles can serve as replacements for media players with capabilities to play films and music from optical media or streaming media services.
The first video game consoles were produced in the early 1970s. Ralph H. Baer devised the concept of playing simple, spot-based games on a television screen in 1966, which later became the basis of the Magnavox Odyssey in 1972. Inspired by the table tennis game on the Odyssey, Nolan Bushnell, Ted Dabney, and Allan Alcorn at Atari, Inc. developed the first successful arcade game, Pong, and looked to develop that into a home version, which was released in 1975. The first consoles were capable of playing only a very limited number of games built into the hardware. Programmable consoles using swappable ROM cartridges were introduced with the Fairchild Channel F in 1976, though popularized with the Atari 2600 released in 1977.
Handheld consoles emerged from technology improvements in handheld electronic games as these shifted from mechanical to electronic/digital logic, and away from light-emitting diode (LED) indicators to liquid-crystal displays (LCD) that resembled video screens more closely. Early examples include the Microvision in 1979 and Game & Watch in 1980, and the concept was fully realized by the Game Boy in 1989.
760c119bf3