当前位置:网站首页>You can't just use console Log ()?
You can't just use console Log ()?
2022-06-12 12:15:00 【Old movie story】
console
1、 We usually only know that there are console.log() This usage
ok , Let me show you something about console Other uses of , Please listen to me
2、console Format printing
First console.log() We all know . In it, we usually use it to output data , In fact, you can also set the output format in it
console.log('hello i am a %s string','student')

console.log('%c I LOVE YOU','font-size:55px;color:pink')

yo , You can also add styles , Isn't that awesome
3、console.warn(), Output a yellow warning
console.warn('hello girl')

4、console.error(), An error message in red is output
console.error('hello error')

5、console.info, And console.log There is no difference in the effect of
console.info('hello world i am hero')

6、console.assert (), Receive two parameters
The first one is about boolen What is the value of , If true Then the second parameter executes
console.assert(1===2,'this is wrong')

7、console.clear(), Clear the console

8、console.dir(), The object used to set the ,dump Get more information
9、console.group() and console.groupEnder(), Classify the same object type
const dogs=[{
name:'jack',age:13},{
name:'lucy',age:12}]
dogs.forEach(dog=>{
console.group(`${
dog.name}`)
console.log(`this is ${
dog.name}`)
console.log(`${
dog.name} is ${
dog.age} year ago`)
console.log(`${
dog.name} is ${
dog.age*4} year ago`)
console.groupEnd(`${
dog.name}`)
})

10、console.count(), Sort the data that outputs the same data
console.count('wes')
console.count('good')
console.count('wes')
console.count('wes')
console.count('good')
console.count('good')
console.count('wes')
console.count('good')

11、console.time(), Count the running time of a piece of code
console.time('fetching data');
fetch('https://api.github.com/users/wesbos')
.then(data => data.json())
.then(data => {
console.timeEnd('fetching data');
console.log(data);
})

12、console.table( ), It is used to display the output data in the form of table
const dogs=[{
name:'jack',age:13},{
name:'lucy',age:12}] console.table(dogs)

It's not learning ,666
边栏推荐
- 宏编译 预处理头 WIN32_LEAN_AND_MEAN
- Chaîne la plus longue sans caractères dupliqués (leetcode 3)
- Load/store instruction addressing mode of arm instruction set (1)
- 导航中,添加边框影响布局的解决方法
- 拿来就能用的网页动画特效,不来看看?
- The difference between bind, call and apply, and the encapsulation of bind()
- Win7 registers out of process components, services, and COM component debugging
- Click to generate 4-bit random number and verify code setting
- ACE配置IPv6, VS静态编译ACE库
- 5G NR協議學習--TS38.211下行通道
猜你喜欢

Performance comparison test of channel and condition variables of golang in single production and single consumption scenarios

Redis的主从复制原理

KDD2022 | 边信息增强图Transformer

QML学习 第二天

Elk construction guide

NDT配准原理

Asynchronous path processing

5G NR協議學習--TS38.211下行通道

DOM+JS+轮播图+无时间

7-5 complex quaternion operation
随机推荐
golang的channel和条件变量在单生产单消费场景下的性能对比测试
VGG小卷积代替大卷积 VS 深度可分离卷积
点击产生4位随机数,验证码设置
[foundation of deep learning] learning of neural network (4)
Kotlin扩展函数实现原理
Cocktail sort
Multiplication instruction of arm instruction set
Google Earth engine (GEE) - quick land classification by kmeans clustering (double for loop quick parameter adjustment)
用vector保存对象时保存指针的优点, 以及reserve的使用
Elk construction guide
宏编译 预处理头 WIN32_LEAN_AND_MEAN
Common debugging tools and commands for ROS
回溯法, 八皇后
無重複字符的最長字符串(LeetCode 3)
Basic concepts of machine learning
关于报文
LeetCode 890. Find and replace mode (analog + double hash table)
QT添加QObject类(想使用信号和槽)遇到的问题汇总,亲测解决有效error: undefined reference to `vtable for xxxxxx(你的类名)‘
Differences between server-side rendering and client-side rendering (advantages and disadvantages)
Stress - system pressure simulation tool