I'm a noob when it comes to JS and am trying to figure out how to return a single value instead of an object when using the .find() function.
Example:
var obj = [
{ name: 'Max', age: 23 },
{ name: 'John', age: 20 },
{ name: 'Caley', age: 18 }
];
var found = obj.find(e => e.name === 'John');
console.log(found);
This will output { name: 'John', age: 20 }
I want it to output John's age (ie: 20
) as a string.
What am I missing?