- Tetris
- Hangman
- Snake
- Comnway game of life
- Chess https://github.com/leereilly/games#user-content-browser-based
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
// Clase base | |
function Person(name, age) { | |
this.name = name; | |
this.age = age; | |
this.config = function () {}; | |
} | |
Person.prototype.getName = function () { | |
return this.name; | |
}; |
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
function Doctor(name, age) { | |
Person.call(this, name, age); | |
} |
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
function Doctor(name, age) { | |
} | |
Doctor.prototype = Object.create(Person.prototype); | |
Doctor.prototype.saludo = function() { | |
console.log(`Saludos soy el doctor ${this.getName()} y tengo ${this.getAge()} años`); | |
}; | |
var doctorAlejandro = new Doctor('Alejandro', 33); |
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
function Doctor() { | |
} | |
Doctor.prototype.saludo = function() { | |
console.log(`Saludos soy el doctor ${this.getName()} y tengo ${this.getAge()} años`); | |
}; | |
var doctorAlejandro = new Doctor('Alejandro', 33); | |
doctorAlejandro.saludo(); // 'Saludos soy el doctor Alejandro y tengo 33 años' |
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
// Clase base | |
function Person(name, age) { | |
this.name = name; | |
this.age = age; | |
this.config = function () {}; | |
} | |
Person.prototype.getName = function () { | |
return this.name; | |
}; |
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
// Super clase | |
function Person(name, age) { | |
this.name = name; | |
this.age = age; | |
this.config = function () {}; | |
} | |
Person.prototype.saludo = function () { | |
console.log(`Hola soy ${this.name} tento ${this.age}`); | |
}; |
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 Mamifero = { | |
tipo: 'desconocido', | |
getTipo: function () { | |
return this.tipo; | |
} | |
}; | |
var humano = Object.create(Mamifero); | |
// Sobre-escribimos el tipo | |
humano.tipo = 'humano'; |
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
function Book(name, year) { | |
// propiedades | |
this.name = name; | |
this.year = year; | |
} | |
// metodos | |
Book.prototype.getName = function () { | |
return this.name; | |
}; |
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 libro = new Book('Don quijote', 1612); | |
var libro2 = new Book('Señor de los anillos', 1930); | |
// Cuando comparamos | |
libro.getName === libro2.getName; // false |