Skip to content

Instantly share code, notes, and snippets.

@parzibyte
Created April 26, 2020 12:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save parzibyte/d5b4c3abe5d5623a86a8087f67a8c20b to your computer and use it in GitHub Desktop.
Save parzibyte/d5b4c3abe5d5623a86a8087f67a8c20b to your computer and use it in GitHub Desktop.
<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