@Ehtesh corrected your syntax, alternatively you can use these methods, as console.log.apply
not works in old versions of IEs (console.log.apply not working in IE9).
Method1:
function log(p_sMessage) {
if(!Debug) { return; }
else { if(window.console) { console.log(p_sMessage); }}
}
Method 2:
var log = Debug && window.console ? window.console.log.bind(window.console) : function() {};
or
var log = (Debug && Window.prototype.Console) ? Window.prototype.console.log.bind(Window.prototype.Console) : function () { };
(Debug flag sets visibility of console messages exclusively)
N.B.: Method 1 works in all browsers (except those do not support console) but does not show the line number from where it was called. Method 2 shows the line number but not works in older IEs.