Posts Tagged ‘JavaScript’
console.log is the most necessary debug tool for javascript ever, but it only works in FireFox with FireBug. Otherwise it gives you an error, could sabotage all of your other javascript. You could just comment them all out before releasing code. OR you can add a condition around it so that it only shows if it won’t error.
For security reasons you may want to comment out the console.logs anyways, but it doesnt hurt to apply this method to make sure it never produces an error.
if(typeof console.log == ‘function’){ console.log(‘your log string or object here’); }
Tags: JavaScript