当前位置:网站首页>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
边栏推荐
- Common debugging tools and commands for ROS
- this的指向
- 鸡尾酒排序
- QML学习 第一天
- LeetCode 890. Find and replace mode (analog + double hash table)
- How to select standard products and non-standard products, the importance of selection, and how to layout the store
- 拿来就能用的网页动画特效,不来看看?
- 开源项目-(ERP+酒店+电商)后台管理系统
- 【Leetcode】416. Split equal sum subset
- 用vector保存对象时保存指针的优点, 以及reserve的使用
猜你喜欢

NDT配准原理

QT添加QObject类(想使用信号和槽)遇到的问题汇总,亲测解决有效error: undefined reference to `vtable for xxxxxx(你的类名)‘

QML学习 第一天

Batch load/store instructions of arm instruction set

Open source project - (erp+ Hotel + e-commerce) background management system

导航中,添加边框影响布局的解决方法

转载--win10打开任务管理器就蓝屏的问题

点云配准--gicp原理与其在pcl中的使用

A. Prefix range
![[foundation of deep learning] learning of neural network (4)](/img/8d/0e1b5d449afa583a52857b9ec7af40.png)
[foundation of deep learning] learning of neural network (4)
随机推荐
Chapter VI data type (V)
MVC模式、加密、jsonwebtoken
Pytoch notes
VGG小卷积代替大卷积 VS 深度可分离卷积
Load/store instruction addressing mode of arm instruction set (1)
点云配准--gicp原理与其在pcl中的使用
Cookies and sessions
【Leetcode】221. Largest Square
imx6-uboot添加lvds1显示
JS将DOM导出为图片的方法
A short guide to SSH port forwarding
Channel shuffle class
[转]placement new
In navigation, the solution of adding borders to affect the layout
The direction of this
Elk construction guide
作物模型的区域模拟实现过程初探
Quic wire layout specification - packet types and formats | quic protocol standard Chinese translation (2) package type and format
How to select standard products and non-standard products, the importance of selection, and how to layout the store
Promise understanding has used promise to realize picture preloading (sequential loading)