How to remove a specific item from an array in JavaScript?
1. Using filter The filter method creates a new array that excludes the specific item(s). Example: const array = [1, 2, 3, 4, 5];const itemToRemove = 3;// Create a new array excluding the itemconst result = array.filter(item => item !== itemToRemove);console.log(result); // Output: [1, 2, 4, 5] 2. Using splice The splice method modifies the […]