How to use 'how to add two arrays in javascript' in JavaScript

Every line of 'how to add two arrays in 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.

All examples are scanned by Snyk Code

By copying the Snyk Code Snippets you agree to
3export function addToArray(a, b) {
4 const i = a.indexOf(b);
5 if (i === -1) {
6 a.push(b);
7 }
8}

Related snippets