Skip to content

Instantly share code, notes, and snippets.



Created Mar 3, 2016
What would you like to do?
Object factory (without prototype) in JavaScript
function createUser(name, height, properties) {
return Object.assign({
name: name,
height: height,
noise: "hello world!",
makeNoise: function() {
}, properties);
var user = createUser("joepie91", "1.94m", {
noise: "hallo!"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.