javascript - Overriding window.alert and passing multiple parameters -


I am trying to override window.alert to pass several parameters.

Please someone tell me why / in the list of inherits.Array.prototype.tester in the body?

Thank you very much.

  array.protipitator = function () {return 'tester'; } Window.alert = function () {var args = Array.prototype.slice.call (logic); Var list = []; For (Argus in var i) {list.push (args [i]); } Return list.joined (','); // Why???? Alert: "arg1, arg2, function () {return" tester ";}" // return args.join (','); // Alert: "arg1, arg2" expected} alert ('arg1', 'arg2');  

As mentioned, for in Defines the properties that are in the object prototype series by itself.

To fix this, use.

 for  (args in var i) {if (args.hasOwnProperty (i)) {List.push (args [i]); }}  

Comments