Navigate back to the homepage

How to check array contains value in javascript

Infinitbility
JavaScript
September 3rd, 2021 · 1 min read
How to check array contains value in javascript

Hello Friends 👋,

Welcome To Infinitbility! ❤️

Javascript provides includes() method to check specific item exist or not in an array and the below example also work on if you searching for React, React Native, typescript, node, deno, next, vue, gatsby and all javascript library.

includes() also use for the search string in the array you have to only pass user search text as a value in the includes() method.

1['red', 'green'].includes('red') //true ✅
2
3['red', 'green'].includes('yellow') //false ❌

includes() method also works on a string, for example, you have description text and you want to search word on paragraph text then it also works.

1"Search String Match or not".includes('or');
2// <.true

Thanks for Reading…

Join our email list and get notified about new content

No worries, I respect your privacy and I will never abuse your email.

Every week, on Tuesday, you will receive a list of free tutorials I made during the week (I write one every day) and news on other training products I create.

Looking For React Native Tutorial?

we are trying to create the best Tutorial for react native developers.

When you want a daily updates about React Native Tutorial or infinitbility update subscribe to our newsletter.

Read React Native Tutorial

Request New Tutorial or Article on mail [email protected]

Tutorials

React Native

Categories

More articles from Infinitbility

How to check empty string in react native

How to check empty string in react native

Check empty string example in react native

September 2nd, 2021 · 1 min read
How to access env variable in laravel

How to access env variable in laravel

Use env variable in laravel controller and blade example

September 1st, 2021 · 1 min read
© 2020–2021 Infinitbility
About
Link to $https://medium.com/infinitbilityLink to $https://www.facebook.com/InfinitbilityLink to $https://github.com/infinitbilityLink to $https://twitter.com/infinitbilityLink to $https://www.buymeacoffee.com/infinitbilityLink to $mailto:[email protected]