Created
May 27, 2022 22:49
-
-
Save FranciscoImanolSuarez/ea9e19c5459e5f6b4962986e7eb5e880 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 crearPersona() { | |
| class Persona { | |
| constructor(nombre, edad, domicilio, amigos) { | |
| this.nombre = nombre; | |
| this.edad = edad; | |
| this.domicilio = domicilio; | |
| this.amigos = []; | |
| } | |
| agregarAmigos(nombre, edad) { | |
| this.amigos.push({ nombre: nombre, edad: edad }); | |
| } | |
| caminar() { | |
| console.log("Caminando..."); | |
| } | |
| respirar() { | |
| console.log("respira por la nariz"); | |
| } | |
| } | |
| return Persona; | |
| } | |
| const persona = crearPersona(); | |
| const romina = new persona("Romina", 24, "Ceferino namuncura"); | |
| romina.agregarAmigos("Juan", 24); | |
| romina.agregarAmigos("Pedro", 21); | |
| romina.agregarAmigos("Maria", 22); | |
| console.log(romina.respirar()); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment