Now can you get it to return the arguments that were past to the function?
English
-
Edited by dazarobbo: 1/29/2013 8:14:46 AM[quote]function Foobar(foo, bar){ return Array.prototype.slice.call(arguments); } alert(Foobar("I am foo", "I am bar"));[/quote] Unless you want them as an array from the function definition. [quote]Object.defineProperty(Function.prototype, "Args", { get: function(){ return /function [^\(]*\((.*)\)/i.exec(this.toString())[1].split(/\s*,\s*/); } }); var foobarArgs = Foobar.Args;[/quote]
-
Nice! You're the Man.