這次帶給大家怎樣使用JS中console['']輸入方法,使用JS中console['']輸入方法的注意事項有哪些,下面就是實戰案例,一起來看一下。
1、console.log是最常用的輸入方法,正常化輸出語句,還具有print佔位符整數(%d||%i),浮點數(%f ),物件(%o),字元(%s);
![](https://img.php.cn/upload/article/000/061/021/aba149099e1b74e87f479d62e5df069c-0.png)
2、console.error輸出錯誤化的語句
![](https://img.php.cn/upload/article/000/061/021/aba149099e1b74e87f479d62e5df069c-1.png)
3、console.info輸出一條訊息化語句
![](https://img.php.cn/upload/article/000/061/021/aba149099e1b74e87f479d62e5df069c-2.png)
#4、console.warn輸出警告化的語句
![](https://img.php.cn/upload/article/000/061/021/72d7037524fda74ef8e4730926cbee28-3.png)
5、console.dir可以查看語句裡的資訊
![](https://img.php.cn/upload/article/000/061/021/72d7037524fda74ef8e4730926cbee28-4.png)
6、console.group輸入分組
![](https://img.php.cn/upload/article/000/061/021/72d7037524fda74ef8e4730926cbee28-5.png)
![](https://img.php.cn/upload/article/000/061/021/72d7037524fda74ef8e4730926cbee28-6.png)
![](https://img.php.cn/upload/article/000/061/021/7e791a84c0ac8e2d06745acd31581aa7-7.png)
![](https://img.php.cn/upload/article/000/061/021/7e791a84c0ac8e2d06745acd31581aa7-8.png)
![](https://img.php.cn/upload/article/000/061/021/7e791a84c0ac8e2d06745acd31581aa7-9.png)
![](https://img.php.cn/upload/article/000/061/021/7e791a84c0ac8e2d06745acd31581aa7-10.png)
#7、console.assert判斷參數是否為真(==代表值相同就行,===代表值和型別都相同)
#8、console.trace ;順藤摸瓜,追蹤函數蹤跡
9、console.time記所載入的時間
##10、console. profile效能分析(每秒鐘刷新頁面的次數)告訴你我不會,,哈哈,################其它的方法暫時不討論,要討論的是哪來的這麼多underfined輸出###############相信看了本文案例你已經掌握了方法,更多精彩請關注php中文網其它相關文章! ######推薦閱讀:#########Node.js console輸出日誌檔實例分析###############怎麼操作jQuery實作滑鼠滑過商品小圖片上顯示對應大圖片##########
以上是怎樣使用JS中console['']輸入方法的詳細內容。更多資訊請關注PHP中文網其他相關文章!