superman

Results 6 comments of superman

function fn (list, id) { function _fn (nodeList) { for (let i = 0, len = nodeList.length; i < len; i++) { const node = nodeList[i] if (node.id == id)...

function rangeDay (day1, day2) { const result = [] const dayTimes = 24*60*60*1000 const startTime = day1.getTime() const range = day2.getTime() - startTime let total = 0 while (total 0)...

const res = {}; const entry = { 'a.b.c.dd': 'abcdd', 'a.d.xx': 'adxx', 'a.e': 'ae' }; for (let key in entry) { setKeypath(res, key, entry[key]); } function setKeypath(obj, keypath, value) {...

const arr = [{id: 1}, {id:2, pId: 1}, {id: 3, pId: 2}, {id: 4}, {id:3, pId: 2}, {id: 5, pId: 4}] function fn (arr) { const cache = {} const...

> #### 一次遍历 > ```js > function findLongest(str) { > if (!str) return {} > let count = 0 > let maxCount = 0 > let cur = str[0] >...