Created
April 26, 2020 12:34
-
-
Save parzibyte/d5b4c3abe5d5623a86a8087f67a8c20b to your computer and use it in GitHub Desktop.
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
<html> | |
<head> | |
<title>PHP Test</title> | |
<script type="text/javascript"> | |
const datos = {"nombre":"Luis Cabrera Benito","videojuegos_favoritos":["Resident Evil 2","Celeste","Cuphead","Donkey Kong"],"edad":22,"mascota":{"nombre":"Maggie"}} // Justo aquí estamos pasando la variable ----^ | |
console.log("Los datos son: ", datos); | |
// Y podemos usar los datos normalmente ;) | |
const nombre = datos.nombre; | |
const videojuegos_favoritos = datos.videojuegos_favoritos; | |
videojuegos_favoritos.forEach(videojuego => console.log("A %s le gusta jugar %s", nombre, videojuego)); | |
</script> | |
</head> | |
<body> | |
<p>Parzibyte.me</p> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment