Last active
August 31, 2018 11:24
-
-
Save kino6052/c3db1e034dc2a12e02c9801244c95124 to your computer and use it in GitHub Desktop.
Elegant way to remove value from an array by index
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let array = [1, 2, 3]; | |
let index = 1; // Any index | |
let filteredArray = array.filter((el, i) => i !== index); // [1, 3] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment