0

I know this is simple but for some reason i am unable to make this work i do not know what i am doing wrong. anyways the purpose for this code is to give an alert box when the element exists inside the array, names

$(doucment).ready(function () {
    var names = ["peter", "John", "mary"];

    if (jQuery.inArray("mary", names)) {
        alert('found');
    }
});

https://jsfiddle.net/jfho9f2q/

Tushar
  • 82,599
  • 19
  • 151
  • 169
kunz
  • 895
  • 1
  • 7
  • 26

0 Answers0