Last active
July 7, 2020 19:51
-
-
Save agustinpfs/b7dd2fe2ecf4520f004590319070628a to your computer and use it in GitHub Desktop.
Javascript básico. Objetos.
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 persona = { | |
nombre: 'Juan', | |
edad: 28, | |
genero: 'masculino', | |
intereses: ['lectura', 'fútbol'], | |
biografia: function () { | |
console.log(this.nombre + ' tiene ' + this.edad + ' años. Le gusta la ' + this.intereses[0] + ' y jugar al ' + this.intereses[1] + '.'); | |
}, | |
saludo: function() { | |
console.log('Hola, soy '+ this.nombre + '. '); | |
} | |
}; | |
console.log(persona.nombre) // Juan | |
console.log(persona.edad) // 28 | |
console.log(persona.intereses[1]) // lectura | |
persona.biografia() // Juan tiene 28 años. Le gusta la lectura y jugar al fútbol. | |
persona.saludo() // Hola, soy Juan. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment