Last active
November 14, 2022 12:51
-
-
Save omas-public/9d69092ecab84952afa4542732838605 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
// 1114.js | |
const arr = [0, 1, 12, 24, 36] | |
const start = 2 | |
const f1 = (arr, start) => { | |
const head = arr.slice(0, 2) | |
const tail = arr.slice(start + 2) | |
return [...head, 16, 25, ...tail] | |
} | |
const f2 = (arr, start) => { | |
const head = arr.slice(0, 2) | |
const tail = arr.slice(start) | |
return [...head, 4, 9, ...tail] | |
} | |
const f3 = (arr, start) => { | |
const head = arr.slice(0, 2) | |
const tail = arr.slice(start + 2) | |
return [...head, ...tail] | |
} | |
const f4 = (arr, start) => { | |
const head = arr.slice(0, 2) | |
return head | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment