Skip to content

Instantly share code, notes, and snippets.

@edubskiy
Created June 22, 2013 19:48
Show Gist options
  • Save edubskiy/5842339 to your computer and use it in GitHub Desktop.
Save edubskiy/5842339 to your computer and use it in GitHub Desktop.
Creates new object and sets its prototype with given
/**
* Creates new object and sets its prototype with given
*
* @param o inherited object
* @returns {object}
*/
create: function(o) {
if (Object.create) {
return Object.create(o);
}
function F(){}
F.prototype = o;
return new F();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment