Created
June 30, 2012 04:40
-
-
Save renatoargh/3022305 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var prototipo = { | |
id: 0, | |
nome: '', | |
idade: 0 | |
}; | |
var construirPessoa = function(id, nome, idade){ | |
var novo = Object.create(prototipo); | |
novo.id = id; | |
novo.nome = nome; | |
novo.idade = idade; | |
return novo; | |
}; | |
var renato = construirPessoa(1, 'Renato Gama', 25); | |
var fulano = construirPessoa(2, 'Fulano da Silva', 21); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment