Skip to content

Instantly share code, notes, and snippets.

@parzibyte
Created August 16, 2019 23:05
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/7e4d83560ac3c856b887e562de980c9a to your computer and use it in GitHub Desktop.
Save parzibyte/7e4d83560ac3c856b887e562de980c9a to your computer and use it in GitHub Desktop.
/**
* Convertir un objeto a un arreglo
* en JavaScript
*
* @author parzibyte
*
* https://parzibyte.me/blog
*/
let alumnosConCalificaciones = {
"Luis": 100,
"Pedro": 90,
"María José": 100,
"John Galt": 99
};
// Object.keys toma las claves, para este ejemplo serían
// los nombres de alumnos
let alumnos = Object.keys(alumnosConCalificaciones);
console.log("Claves: ", alumnos);
/*Salida:
Claves: [ 'Luis', 'Pedro', 'María José', 'John Galt' ]
*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment