javascript - JSLint: Read Only error when setting console even though it's set as writable global -


consider following code:

/*global console:true */ (function () {     "use strict";      //set console browsers without debugger     if (!console) {         console = {             log: function() {}         };     } }); 

this throw error:

error: problem @ line 7 character 9: read only.  console = {  problem @ line 7 character 9: stopping. (3% scanned). 

yet, console has been set writeable global, should not read only.

any suggestions on how circumvent or solve issue?

thanks.

i copied code , tried www.jslint.com, had change 2 small things gives me no errors (added 1 space after "function" , added self invokation) :

/*global console:true */ (function () {     "use strict";      //set console browsers without debugger     if (!console) {         console = {             log: function () {}         };     } }()); 

where did try it?


Comments

Popular posts from this blog

c++ - Is it possible to compile a VST on linux? -

java - Output of Eclipse is rubbish -

jquery - Confused with JSON data and normal data in Django ajax request -