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

Popular posts from this blog

html - Sizing a high-res image (~8MB) to display entirely in a small div (circular, diameter 100px) -

java - IntelliJ - No such instance method -

identifier - Is it possible for an html5 document to have two ids? -