Skip to content

Instantly share code, notes, and snippets.

@drola
Created June 28, 2021 04:46
Show Gist options
  • Save drola/948e59e5d3138490730b8bb2168aa6c0 to your computer and use it in GitHub Desktop.
Save drola/948e59e5d3138490730b8bb2168aa6c0 to your computer and use it in GitHub Desktop.
Utils
/**
* 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