Reputation: 12785
When i write javascript code , i usually insert a debug symbols to help me out .
Let me illustrate what i mean by example :
var debug = true;
/* Some event handler */
onValueChange = function(e, ui){
var new_value = dom.volume.slider("value");
conf.value = new_value;
if (debug) {
console.log("Value changed to : " + new_value);
}
}
when i finish, i don't want all this debug related code to be part of my release/minified codebase . what is the convention for this sort of thing ? are there any (non IDE based) tools available ? I am looking for solutions working with exiting codebase and for starting a new project in the future .
Or what other debugging strategies exist in javascript world ?
Upvotes: 4
Views: 643
Reputation: 71
Use FireBug in Fire Fox . it will help you a lot to debug java script code.
Upvotes: 1
Reputation: 550
To get rid of this logging code you will need to write a parser! I suggest that you go with a different debugging strategy. console.log
is no doubt useful but a full fledged debugger like: the one provided by Chrome DevTools, is strongly advised.
You can inject break points at any position in your code with debugger;
. Going with a real debugger will make your life as a developer much more easier.
Upvotes: 1