-
-
Save DavidPeralvarez/354cad0ee503dae3c7fe020e28728ec2 to your computer and use it in GitHub Desktop.
JavaScript - this
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<title>Curso de Javascript</title> | |
</head> | |
<body> | |
<script src="scripts.js"></script> | |
</body> | |
</html> |
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 nombreCancion = 'Título de la canción'; | |
var spotify = { | |
nombreCancion: 'Here comes your man', | |
artista: 'Pixies', | |
reproducirCancion: function(){ | |
// console.log( 'Estoy reproduciendo una canción.' ); | |
// console.log( this ); | |
console.log( 'Estoy reproduciendo: ' + this.nombreCancion ); | |
}, | |
anuncioSpotify: function(){ | |
console.log( 'Hola, soy un anuncio.' ); | |
}, | |
premium: { | |
activado: false, | |
precio: 7, | |
mostrarPrecio: function(){ | |
console.log( 'El precio de la suscripción premium es de: ' + this.precio ); | |
} | |
} | |
}; | |
// console.log( spotify.nombreCancion ); | |
// console.log( spotify.anuncioSpotify() ); | |
console.log( spotify.reproducirCancion() ); | |
console.log( spotify.premium.mostrarPrecio() ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment