How to remove a specific item from an array in JavaScript
Two common ways:
Change the original array
const i = arr.indexOf("b");
if (i !== -1) arr.splice(i, 1);splice(start, count) removes items in place.
Make a new array
const next = arr.filter(x => x !== "b");
filter keeps the original unchanged and removes every match. Use it when working with React state.