题目要求: _.once(func)可以用来缓存结果使得原函数至多被调用一次。 能否自己实现一个once()? function func(num) { return num } const onced = once(func) onced(1) // 1 onced(2) // 1,因为已经调用过了,前一次的结果被直接返回 题目出处: https://bigfrontend.dev/zh/problem/implement-once https://bigfrontend.d...

Markdown supported · ⌘↵ to post
No responses yet.