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
本文共 364 字,大约阅读时间需要 1 分钟。
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
转载于:https://www.cnblogs.com/Byme/p/8270822.html