how to take out a value from an array in javascript code example

Example 1: how can i remove a specific item from an array

const items = ['a', 'b', 'c', 'd', 'e', 'f']
const i = 2
const filteredItems = items.slice(0, i).concat(items.slice(i + 1, items.length))
// ["a", "b", "d", "e", "f"]

Example 2: exclude vales from array in js

var array = [1, 2, 3, 4, 5, 6, 7, 8, 9, 0];
var filtered = array.filter(function(value, index, arr){ 
  return value > 5;
});
//array => [1, 2, 3, 4, 5, 6, 7, 8, 9, 0]
//filtered => [6, 7, 8, 9]

Tags:

C Example