Get the App
SLTechnology News&Howtos  ›  Internet Technology  › 

What's the use of Console Api?

Shulou Source: shulou.com Published: 2022-06-01 06:35:46 10月04日 Update

This article mainly introduces the use of Console Api, has a certain reference value, interested friends can refer to, I hope you can learn a lot after reading this article, the following let the editor take you to understand it.

All Console Api

Console.dir (console)

Display simple information

Console.log ('hello world')

Console.info ('Information')

Console.error ('error')

Console.warn ('warning')

Placeholder

Console.log ('% dmurt% dmurt% dmae1% scurijimi 2016, 08pr 21 'Chinese women's volleyball team won the championship!')

Count the number of code execution

Function getInfo ()

{

Console.count ('number of execution:')

}

GetInfo ()

GetInfo ()

GetInfo ()

GetInfo ()

Display grouping information

Console.group ("first set of messages")

Console.log ('Group 1: custom message 1')

Console.log ('Group 1: custom message 2')

Console.log ('Group 1: custom message 3')

Console.groupEnd ()

Console.group ("second set of information")

Console.log ('Group 2: custom message 1')

Console.log ('Group 2: custom message 2')

Console.log ('Group 2: custom message 3')

Console.groupEnd ()

Display object information

Var TomObj = {

Name: "Tom"

Sex: "male"

Age: '31'

Hobby: "coding..."

}

Console.dir (TomObj)

Display page information

Console api

Var info = document.getElementById ('console')

Console.dirxml (info)

Determine whether an expression or variable is true

Var code = 200

Console.assert (code)

Console.assert (code = 200)

Console.assert (code = = 500)

Trace the call trajectory of a function

Function add (a _ r _ b) {

Console.trace ()

Return a + b

}

Add (1 dint 2)

Add (2pr 3)

Add (3pr 4)

Timing function

Console.time (console timer)

Console.log ('Start')

For (var iTuno Bandi)

Tags: Information message article console control performance times timer analysis warmth code value interest champion function analyzer function variable at the same time women's volleyball team Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Docker macOS Huawei vpn Apple