2 n, j. f3 n0 C0 E; G. A- Y 2. console.error()" k4 O; e# o3 q K0 o' B8 `
此方法用于将错误消息记录到控制台。在测试代码时很有用。默认情况下,错误消息将突出显示为红色。 # e, P- j1 |; B+ X w* _# o+ s7 q: a
// console.time() and console.timeEnd() method
// console.time() method
console.time("Let's see time console")
let time1 = function(){
console.log('time1 function is running')
}
let time2 = function(){
console.log('time2 function is running')
}
time1()
time2()
// console.timeEnd() method
console.timeEnd('Time Taken')
/ N9 J+ h7 d- }- [ 6. console.table()& v8 }# O& v5 d. W
这个方法允许我们在控制台中生成表格。输入数据必须是数组或显示为表格的对象。 9 k& P3 R; i; O
// console.group() and console.groupEnd() method
// console.group() method
console.group('This is a sample group')
console.log('This is a sample group log')
console.warn('This is a sample group warning')
console.error('This is a sample group error')
// console.groupEnd() method
console.groupEnd('This is a sample group')
console.log('This is a new section')