I am struggling to find a solution for the following problem. Instead of returning 1, the index is always -1 in this case.
Can anyone assist me with this?
let allRules = [{ruleName: "a"}, {ruleName: "b"}, {ruleName: "c"}]
let name = "b"
let index = allRules.findIndex(x => {
console.log(x.ruleName)
x.ruleName === name
})
console.log(index)