Skip to content

Instantly share code, notes, and snippets.

@AlvisonHunterArnuero
Last active April 29, 2020 04:36
Show Gist options
  • Save AlvisonHunterArnuero/91ffdf6916335ea1d987c84e8230b373 to your computer and use it in GitHub Desktop.
Save AlvisonHunterArnuero/91ffdf6916335ea1d987c84e8230b373 to your computer and use it in GitHub Desktop.
Un poco de destructurado con arreglos y objetos o viceversa, usando un arreglo de objetos como ejemplo para este codigo sencillito.
// WE WILL CONVERT AN ARRAY OF OBJECTS INTO AN ARRAY USING THE MAP HELPER AND DESTRUCTURING
// WE WILL BE USING SOME OF THE COURSES OF UNIVERSIDAD DE INGIENERIA [UNI] MANAGUA AS SAMPLES
const classes = [
["Cloud Computing", "9:00 AM", "Danilo Rodríguez", "Estudios de Posgrado"],
[
"Hacking y Ciber Seguridad",
"8:00 AM",
"Jorge Gutiérrez",
"Recinto Ricardo Morales Avilés"
],
[
"Desarrollo de Aplicaciones con Visual C# y SQL Server",
"10:15 AM",
"Denis Guido",
"Edificio de Posgrado"
],
[
"Redes de Computadoras Avanzado",
"11:30 AM",
"Carlos Rodriguez",
"Edificio de Posgrado"
]
];
const classesAsObject = classes.map(item => {
return { topic: item[0], time: item[1], teacher: item[2], location: item[3] };
});
// LET US PRINT THE GENERATED ARRAY ON THIS LINE, HOPE YOU LIKE THIS EXCERCISE, GUYS!
classesAsObject;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment