find array element from string and replace it from another element in javascript code example
Example 1: replace array element javascript stack overflow
var index = items.indexOf(3452);
if (index !== -1) {
items[index] = 1010;
}
Example 2: replace array element javascript stack overflow
if (haystack.includes(needle)) {
// do your thing
}