11 lines
208 B
JavaScript
11 lines
208 B
JavaScript
|
|
||
|
function findProperty(array, property) {
|
||
|
|
||
|
const index = array.findIndex((item) => {
|
||
|
return item[property] !== undefined
|
||
|
})
|
||
|
|
||
|
return array[index][property]
|
||
|
}
|
||
|
|
||
|
module.exports = findProperty
|