Some Console Methods

SHOYUF

  1. Assert: Throw some Infomation about FALSE(first option).

  2. Clear: Equal shell command clear.

  3. Count: Count Call frequency in Function, Option named Label.

  4. Dir: tree version in browser console, VM show typeof value.

  5. Dirxml: tree version in browser console, not Compatiable in Node.js.

  6. Error: show Error in browser console.(x icon and red background).

  7. Group/GroupEnd: create a new Tree Structure in console, use groupEnd method to end this group.

  8. Info/Debug: same like Log. Debug not support in Chrome.

  9. Log: show Log in browser console.(normal background).

  10. Warn: show Information in browser console.(! icon and yellow background).

  11. Table: show Table Style in browser console, supported normal Array,construction Function,dyadic Array, Object Array and some ways.

  12. Time/TimeEnd: create a timer to during on the Opertion, must have unique name.

  13. TimeStamp: create a mark in Timeline tools in browser.

  14. Trace: create a trace route in browser.

// example.14
foo();

function foo() {
  function bar() {
    console.trace();
  }
  bar();
}
Other:
  1. Format
for (var i=0; i<5; i++) {
  console.log("Hello, %s. You've called me %d times.", "Bob", i+1);
}
console.log("I want to print a number:%d","string")
  1. Style
console.log("%cMy stylish message", "color: red; font-style: italic");

Quoto:

  1. WebApis - Console

本站使用署名 4.0 国际 (CC BY 4.0) 创作共享协议,转载请署名,图片请转存。

提醒:本文最后更新于 2085 天前,文中所描述的信息可能已发生改变,请谨慎使用。

湘ICP备13009407号