Created
September 17, 2018 20:44
-
-
Save fhdez/dd68e1001e55f359d33e91d72e05e79e to your computer and use it in GitHub Desktop.
This file contains hidden or 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 idSeleccionado = 1; // Español | |
var nme = [ | |
{id: 1, nombre: "Español", slug: "1-espanol"}, | |
{id: 5, nombre: "Matemáticas", slug: "5-matematicas"}, | |
{id: 8, nombre: "Exploración y Comprensión del Mundo Natural y Social", slug: "8-social"}, | |
{id: 14, nombre: "Educación socioemocional", slug: "14-educacion-socioemocional"}, | |
{id: 16, nombre: "Educación Física", slug: "16-educacion-fisica"} | |
]; | |
console.log(nme); | |
console.log(nme[idSeleccionado]); | |
// busco comparar el nombre para definir otro metodo, ya que las id siempre van a cambiar | |
// es decir nme[1].nombre === 'Español' ... do something | |
// pero aquí el id 1 lo pone como un array y trayendo 'Matemáticas' en lugar de 'Español' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment