js 判断数组中是否有某值
function arrHasValue(v, arr) { var output = false; for (var i in arr) { if (v == arr[i]) { output = true; return output; } } output = false; return output; }
var arrs = ['1','2','3'];
console.log(arrHasValue(1,arrs)); //true
function arrHasValue(v, arr) { var output = false; for (var i in arr) { if (v == arr[i]) { output = true; return output; } } output = false; return output; }
var arrs = ['1','2','3'];
console.log(arrHasValue(1,arrs)); //true