Last active
April 5, 2022 06:40
-
-
Save ikasoba/0179f9a48b876ae960eb0ca1c1939467 to your computer and use it in GitHub Desktop.
Typescriptの再帰型の練習に再帰的にn~0までArray。range(10)としたら10~0の長さ11の配列が出来上がります。
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
export const range = (i=0)=>[i,...([()=>range(i-1),()=>[]][~~(i<=0)]())] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment