Friday, March 1, 2013

How to find if an array contains a specific string in JavaScript/jQuery?

var cat = [];
cat.push('1');
cat.push('2');
cat.push('3');

var found = $.inArray('1', cat) > -1;

No comments:

Post a Comment