Skip to content

[js] 第661天 请使用js实现一个无限累加的函数 #3526

Open
@haizhilin2013

Description

@haizhilin2013
Collaborator

第661天 请使用js实现一个无限累加的函数

3+1官网

我也要出题

Activity

xujs0813

xujs0813 commented on Feb 5, 2021

@xujs0813

需要有示例,不然什么叫无限累加?

crush2020

crush2020 commented on Feb 5, 2021

@crush2020

是这种吗?n=2n

qiupo

qiupo commented on Feb 5, 2021

@qiupo

无限累加是指什么?
是这样
function fn(n){ setTimeout(()=>{ n++; },0); fn(n); }
还是这样啊
function fn(n){ fn(++n); }

web3-jimmy

web3-jimmy commented on Feb 7, 2021

@web3-jimmy

const sum = (...args) => args.reduce((prev, cur) => prev + cur)
这种吗?

wheatup

wheatup commented on Feb 8, 2021

@wheatup

估计是指这题吧:

输入 输出
add(1)() 1
add(1)(2)() 3
add(1, 2)() 3
add(1, 2)(3)() 6
add(1)(2, 3)(4)() 10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    jsJavaScript

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @haizhilin2013@wheatup@qiupo@xujs0813@crush2020

        Issue actions

          [js] 第661天 请使用js实现一个无限累加的函数 · Issue #3526 · haizlin/fe-interview