Skip to content

Instantly share code, notes, and snippets.

View silentmatt's full-sized avatar

Matthew Crumley silentmatt

View GitHub Profile
@silentmatt
silentmatt / construct.js
Created May 3, 2009 02:17
Call a constructor with an array of arguments (apply for constructors)
function construct(constructor, args) {
function F() {
return constructor.apply(this, args);
}
F.prototype = constructor.prototype;
return new F();
}
function firefox_construct(constructor, args) {
var o = {};