Skip to content

Instantly share code, notes, and snippets.

@renatoargh
Created June 30, 2012 04:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save renatoargh/3022305 to your computer and use it in GitHub Desktop.
Save renatoargh/3022305 to your computer and use it in GitHub Desktop.
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