[Solved] Search for a value within an object in javascript [closed]


rules = []

rules[0] = { word:"house"}
rules[1] = { word:"shoes"}
rules[2] = { word:"tools"}
rules[3] = { sentence:"horse"}

rules.forEach(rule => {
    if (rule.word) {
      console.log('Exist. Value:', rule.word)
    } else {
      console.log('Doesn\'t Exist.')
    }
})

Hope this helps!

solved Search for a value within an object in javascript [closed]