How to check if a value exists in an array using Javascript or Jquery

Md Riyazuddin Verified

We will check for a value that exists in an array in 2 different ways using Javascript and jQuery.

<script>
const fruits = ["Banana", "Orange", "Apple", "Mango"];
console.log(fruits.includes("Banana"));
</script>
$.inArray(value you wanted to search,  an array from where you want to search);


Comments

Leave a Comment