A more modern, ECMAScript 2015ECMAScript 2015 (formerly known as Harmony or ES 6 6) approach. Given:
const items = [1, 2, 3, 4]; const index = 2; Then:
items.filter((x, i) => i !== index); Yielding:
[1, 2, 4] You can use Babel and a polyfill servicepolyfill service to ensure this is well supported across browsers.