Skip to content

Instantly share code, notes, and snippets.

@Diullei
Created February 2, 2012 22:30
Show Gist options
  • Save Diullei/1726203 to your computer and use it in GitHub Desktop.
Save Diullei/1726203 to your computer and use it in GitHub Desktop.
(function(exports){
function Carro(marca){
this.marca = marca;
}
// campo público!
Carro.prototype.Km = null;
Carro.prototype.andar = function(){
console.log('andando a ' + this.Km + 'km/h');
}
exports.Carro = Carro;
})(this);
var camaro = new Carro('camaro');
camaro.Km = 3;
camaro.andar();
//=> andando a 3km/h
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment