Created
October 26, 2020 15:59
-
-
Save KyleMit/a66662b47b2a545e29e9314aa74da1b2 to your computer and use it in GitHub Desktop.
Twitter - Find Index
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
let pets = [ | |
{ name: "Ranger", type: "Dog" }, | |
{ name: "Gill", type: "Cat" }, | |
{ name: "Frida", type: "Cat" } | |
] | |
let startWithGIndex = pets.findIndex(el => el.name.startsWith("G")) | |
console.log(nameStartWithGIndex) // 1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment