I have an array of objects, all of them with the same properties, but one of those properties should be a function, that decides if the object is “visible” or not
Something like:
let ObjArr = [{
name: 'Charles',
age: 30,
visible: (aName, anAge) => {
return (((this.name === aName) && (this.age === anAge)) ? true : false)
}
}]
console.log(ObjArr[0].visible('Charles', 30)) // It should be true
console.log(ObjArr[0].visible('Peter', 30)) // It should be false
console.log(ObjArr[0].visible('Charles', 25)) // It should be false too
Currently, all of them say false, but the first should be true
Thanks in advance
Rafael