Recently I was working on a javascript project that someone else created. I needed to fix a few things and add a new feature. The person previously created this little log function that was part of the main object.
| var object = { | |
| log : function (data){ | |
| if( typeof console != 'undefined') | |
| console.log(data); | |
| } | |
| } | |
| }; |
Now I know it's the simplest thing but totally takes care of having to delete console.log() on code going to a production site. I know it's the little things but this is something I'm going to include in all my projects going forward.