var data = [];
data.push({
Id: 1,
name: "ONE"
});
data.push({
Id: 2,
name: "TWO"
});
data.push({
Id: 3,
name: "THREE"
});
data.filter(function(item) {
if (item.Id == 1) {
return item.name = display();
}
});
function display() {
return "Formatted Text";
}
I am using javascriptarray filter function to find a value inside javascriptarray of objects. I am not able to use display() function inside this filter.
Compiler keeps telling display() function is undefined.
displaywould be undefined