Posted By

inamorix on 12/04/07


Tagged

js


Versions (?)

Who likes this?

1 person have marked this snippet as a favorite

korzhik


ref


 / Published in: JavaScript
 

  1. String.prototype.ref = function () {
  2. for (var args = [], i = 0; i < arguments.length; i++)
  3. args.push('arguments[' + i + ']');
  4. if (window[this] && window[this] instanceof Function)
  5. return eval('(new window.' + this + '(' + args.join(',') + '))');
  6. throw new Error('Function window.' + this + ' does not exist.');
  7. };

Report this snippet  

You need to login to post a comment.