Delete item from an array

PHOTO EMBED

Wed Apr 28 2021 11:45:01 GMT+0000 (Coordinated Universal Time)

Saved by @JamonJamon #javascript

const array = [2, 5, 9];

console.log(array);

const index = array.indexOf(5);
if (index > -1) {
  array.splice(index, 1);
}

// array = [2, 9]
console.log(array); 
content_copyCOPY