Augusto Goulart
  • About
  • Scalable Python for the Web
Sign in Subscribe

Javascript

A collection of 1 post
Javascript

Checking if an Object Exists in an Array

The includes() method in JavaScript allows you to check if a value exists in an array. For primitive types, you can do: const primitiveArray = [1,2,3,4,5] primitiveArray.includes(3) > true You can also pass a second optional argument to includes() defining the first index of the search.
Jan 14, 2021 1 min read
Page 1 of 1
Augusto Goulart © 2023
  • GitHub
  • Linkedin
Powered by Ghost