Skip to main content
Deno 2 is finally here 🎉️
Learn more
Module

x/deno/cli/js/deno.ts>Console

A modern runtime for JavaScript and TypeScript.
Go to Latest
class Console
import { Console } from "https://deno.land/x/deno@v0.28.0/cli/js/deno.ts";

Constructors

new
Console(printFunc: PrintFunc)

Properties

assert: (condition?, ...args: unknown[]) => void

Writes an error message to stdout if the assertion is false. If the assertion is true, nothing happens.

ref: https://console.spec.whatwg.org/#assert

clear: () => void
count: (label?) => void
countReset: (label?) => void
debug

Writes the arguments to stdout

dir: (obj: unknown, options?: ConsoleOptions) => void

Writes the properties of the supplied obj to stdout

dirxml

From MDN: Displays an interactive tree of the descendant elements of the specified XML/HTML element. If it is not possible to display as an element the JavaScript Object view is shown instead. The output is presented as a hierarchical listing of expandable nodes that let you see the contents of child nodes.

Since we write to stdout, we can't display anything interactive we just fall back to console.dir.

error

Writes the arguments to stdout

group: (...label: unknown[]) => void
groupCollapsed
groupEnd: () => void
indentLevel: number
info

Writes the arguments to stdout

log: (...args: unknown[]) => void

Writes the arguments to stdout

table: (data: unknown, properties?: string[]) => void
time: (label?) => void
timeEnd: (label?) => void
timeLog: (label?, ...args: unknown[]) => void
trace: (...args: unknown[]) => void
warn: (...args: unknown[]) => void

Writes the arguments to stdout

[isConsoleInstance]: boolean