someone can help me to create a predicate function into the method findKey() of (_) object .so that function looks through a value property to find word have “w” character that’s her code :
const _ = {
findKey (object, predicate) {
for (let property in object) {
let prop = object[property]
function predicate (prop) {
for(let property in object) {
for(let i = 0; i < prop.length; i++) {
if(prop[i] == "w")
return property
}
return "undefined"
}
}
}
}
}
console.log(_.findKey({'name': 'pedro', 'surname': "pedrossa", 'adress' :"kairwan"}))
module.exports = _;