Skip to content

Instantly share code, notes, and snippets.

@KyleMit
Created October 26, 2020 15:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save KyleMit/a66662b47b2a545e29e9314aa74da1b2 to your computer and use it in GitHub Desktop.
Save KyleMit/a66662b47b2a545e29e9314aa74da1b2 to your computer and use it in GitHub Desktop.
Twitter - Find Index
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