J
J
> @JackFGreen can you update this? @Djaler updated, check the new version
```js const data = [ { id: '1', name: 'test1', children: [ { id: '11', name: 'test11', children: [ { id: '111', name: 'test111' }, // { // id: '112',...
感觉那些 next 的都是正统猿啊,学习了😂 ```js function outSleep(t) { return new Promise(r => { setTimeout(() => { console.log(""); console.log(`...outSleep ${t}`); r(); }, 1000 * t); }); } function LazyMan(name) { const lazy...
```js // [ [ 3, 4, 5 ], [ 10, 11 ], [ 20 ], [ 92 ] ] const arr = [92, 10, 3, 4, 5, 11, 10, 11,...
```js /** 求两个日期中间的有效日期 如 2015-2-8 到 2015-3-3,返回【2015-2-8 2015-2-9...】 */ const start = '2015-2-8' const end = '2015-3-3' function getDates (start, end) { const startMS = new Date(start).getTime() const endMS =...
```js /** 有一堆扑克牌,将牌堆第一张放到桌子上,再将接下来的牌堆的第一张放到牌底,如此往复; 最后桌子上的牌顺序为: (牌底) 1,2,3,4,5,6,7,8,9,10,11,12,13 (牌顶); 问:原来那堆牌的顺序,用函数实现。 */ const res = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13] /** => 231 32 3...
```js // 编程题,找出字符串中 **连续** 出现最多的字符和个数(蘑菇街) const str1 = 'abcaakjbb' const result1 = { a: 2, b: 2 } const str2 = 'abbkejsbcccwqaa' const result2 = { c: 3 } function...
[分享一个来自 Vuex 的 deepCopy](https://github.com/vuejs/vuex/blob/dev/src/util.js#L22) 解决了循环引用,cache 存储所有嵌套 obj 及其 copy 副本,以 cache 中是否有某个嵌套 obj 来判断是否循环引用,有则返回 引用的 copy ```js export function deepCopy (obj, cache = []) { // just return if obj...