mirror of
https://github.com/morbalint/kemkas.git
synced 2026-07-18 03:13:46 +00:00
level 3 maybe?
This commit is contained in:
@@ -0,0 +1,6 @@
|
||||
export function arraySetN<T>(array: T[], n: number, elem: T): T[] {
|
||||
if (array.length < n || n < 0) {
|
||||
return array
|
||||
}
|
||||
return [...array.slice(0, n), elem, ...array.slice(n+1)]
|
||||
}
|
||||
Reference in New Issue
Block a user