I'd like to create a function that iterates through an array containing separate objects with name, surname and age properties. The function should take a parameter "name" and return the name, surname and age in the console.
How would I do this? I've looked at some other questions but can't seem to figure out how to do it. I've created this so far...
var people = [
{ name: "Sue", surname: "Beckett", age: 50},
{ name: "Bill", surname: "Borough", age: 44},
{ name: "Janet", surname: "Jupp", age: 23},
{ name: "Peter", surname: "Pepper", age: 21},
{ name: "Samantha", surname: "Salad", age: 17}
];
function person(name) {
// code here
}
person(sue)
filterorfindin latest version of JS.