Every line of 'check if value already exists in array javascript' code snippets is scanned for vulnerabilities by our powerful machine learning engine that combs millions of open source libraries, ensuring your JavaScript code is secure.
81 function valueExists(value: any) { 82 return value != null; 83 }
3 function addToArrayIfNotThere(value, array) { 4 var i; 5 for (i = 0; i < array.length; i++) { 6 if (array[i] === value) { 7 return i; 8 } 9 } 10 array[i] = value; 11 return i; 12 }
346 function isExistingAndAdd(search: string, array: string[]) { 347 if (array.indexOf(search) >= 0) { 348 array.push(search); 349 return true; 350 } 351 array.push(search); 352 return false; 353 }