Avoid javascript errors in IE using console.log


/ Published in: JavaScript
Save to your folder(s)



Copy this code and paste it in your HTML
  1. function debug(what){
  2. if(window.console && window.console.firebug){
  3. console.log(what);
  4. }
  5. else{
  6. alert(what);
  7. }
  8. }
  9.  
  10.  
  11.  
  12. function prueba(){
  13. var algo = document.getElementById('test');
  14. debug(algo);
  15. }

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.