Created
October 18, 2020 20:57
-
-
Save jonathan-fielding/4943a609859294cf117211a54ed9da7a to your computer and use it in GitHub Desktop.
Array. find
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const fruits = [{ | |
id: 1, | |
name: "Banana" | |
}, { | |
id: 2, | |
name: "Orange" | |
}, { | |
id: 3, | |
name: "Apple" | |
}, { | |
id: 4, | |
name: "Mango" | |
}, { | |
id: 5, | |
name: "Kiwi" | |
}]; | |
const banana = fruits.find((fruit) => fruit.name === "Banana") | |
console.log(banana); // { id: 1, name: "Banana" } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment