What does 0; means in javascript -
looking @ grunt-strip plugin remove console.logs. realized replaces console.log statements 0;
. 0;
have effect?
it doesn't have effect, no. js evaluates 0
, nothing picks result. idea removing console.*
(with simple replace nothing) might break code this:
if(condition) console.log(''); functioncall();
would become (with reformatting emphasis...)
if(condition) functioncall();
so it's replaced dummy statement.
if(condition) 0; // nothing functioncall();
also, code checking if console present return false because 0
falsy.
if(console) { // not executed when replaced if(0) // debugging action }
Comments
Post a Comment