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 ✅23['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…
Follow me on Twitter
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.