摘要: 57、按照给定的函数对比两个数组的差异,然后找出交集,最后从第一个数组中将对应的元素输出。 const intersectionWith = (a, b, comp) => a.filter(x => b.findIndex(y => comp(x, y)) !== -1); intersectio 阅读全文
posted @ 2020-07-14 10:00 jmwlhj 阅读(150) 评论(0) 推荐(0) 编辑
摘要: 29、将输入的数字拆分成单个数字组成的数组。 const digitize = n => [...`${n}`].map(i => parseInt(i)); digitize(431); // [4, 3, 1] 30、计算两点之间的距离 const distance = (x0, y0, x1, 阅读全文
posted @ 2020-07-14 09:53 jmwlhj 阅读(148) 评论(0) 推荐(0) 编辑