console.table
const users = [
{id:1,name:'WDE'},
{id:2}
]
console.log(users)
output
|(index)|id|name|
|--|--|--|
|0|1|WDE|
|1|2||
console.time
estimate time complexity of a program in ms🤣
console.log('fetching')
fetch('url').then(()=>{
//awaiting response
console.timeEnd('fetched') //fetched:0ms
})
console.dir
will display all property related to that datatype
const obj = {
name:'aryan',
age:26
}
console.dir(obj);
output1
Object {name:'aryan',age:21}
console.trace
It will display call stack in decending order. last executed to firstly executed.
function foo(){
function boo(){
//do something
console.trace() // start tracing
}
boo();
}
// boo
// foo
// anonymous
console.assert
The console.assert()
static method writes an error message to the console if the assertion is false. If the assertion is true, nothing happens.
console.log(condition,error)
console.assert(0===1,'not true')
ps: i dnot know use of this🤣
console.count
function fun(x){
console.count(x);
}
//count the number of fun runs
fun('hi')
fun('hi')
fun('hi')
fun('hi')
output
'hi': 4
clean the console.clear() 🤣
console.log('pre written message')
console.clear() // hey javascript clear all prev message
console.log('new messages aryan')
list in console.group()
output
do this
step1:follow
step2:like
code
console.group('do this')
console.log('setp1:follow')
console.log('setp2:like')
console.groupEnd() //reset
post-credit:@code4git
learning resources
🧡Scaler - India's Leading E-learning
🧡w3schools - for web developers
Top comments (0)