![](/style/images/good.png)
![](/style/images/bad.png)
more universal debugging with console
source link: https://www.otsukare.info/2010/11/29/console-debug
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
more universal debugging with console
Rob Campbell gives a neat way to debug without being specific to one type of debugging tool.
A better way is to test for each function you want to use:
if ("console" in window && "time" in window.console) // define your method
\ This has the benefit of not coding for one particular type of debugging tool, will allow for graceful fallback in the event that your feature is not defined and allow you to tailor your debugging around different feature sets.
update 2010-11-30: Rui Nibau is using another method.
This article is published with a CC0 license
Karl Dubost on otsukare
Recommend
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK