JavaScript让前端飞Web前端之路

JavaScript Console的常见用法

2020-05-08  本文已影响0人  Nian糕
Unsplash
// 普通信息
console.log("normal")
// 提示性信息
console.info("information")
// 错误信息
console.error("error")
// 警示信息
console.warn("warn")
// 清空控制台信息
console.clear()
console.group("食品搭配")
console.log("年糕")
console.log("小笼包")
console.groupEnd()
运行结果
let info = {
    name : "longchenmm",
    age : 18,
    wechat : "nothing",
    getName : function(){
        return this.name
    }
}
console.dir(info)
运行结果
console.dirxml(document.getElementById("info"))
const wx = false
console.assert(wx, '你微笑时很美')
运行结果
function myCount(){
    console.count("执行的次数")
}
myCount()
运行结果
let infoList = [
    {
        name : "longchenmm",
        age : 18,
        wechat : "nothing"
    },
    {
        name: "niangao",
        age: 17,
        wechat: "anything"
    }
]
console.table(infoList)
运行结果 运行结果
End of File

行文过程中出现错误或不妥之处在所难免,希望大家能够给予指正,以免误导更多人,最后,如果你觉得我的文章写的还不错,希望能够点一下喜欢关注,为了我能早日成为简书优秀作者献上一发助攻吧,谢谢!^ ^

上一篇 下一篇

猜你喜欢

热点阅读