mardi 16 octobre 2018

Creating a forEach statement for a JavaScript tree of arrays

first of all, I’d like to say I’m new to Stack Overflow, so. If my question has errors in it please note I’m a newbie. Anyways, so I’m creating a pure JavaScript database and I’m using a string array that is in the same format as this:

var SampleArray = [{
   "Food” : "banana”,
   "Strawberry”,
   "Grapes”,
   "Vegitables” : [{
     "Carrot”,
     "Peppers”
   }]
   "Words” : "hello”,
   "Goodbye”,
   "Grapes”,
   "Adjectives” : [{
     "Good”,
     "First”
   }]
}]

Hopefully you get the gist of the array part, but the real question is, how can i create a search box that uses something like forEach statement to find a certain variable within the array, like "good”.




Aucun commentaire:

Enregistrer un commentaire