Created
June 28, 2021 04:46
-
-
Save drola/948e59e5d3138490730b8bb2168aa6c0 to your computer and use it in GitHub Desktop.
Utils
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
/** | |
* Create a new array without the n-th element from the original array | |
* | |
* @param arr | |
* @param n | |
* @returns New array without the n-th element from the original array | |
*/ | |
export function arrayWithoutNth(arr: Array<any>, n: number) { | |
return arr.filter((_, i) => i !== n); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment