cliYao

Results 4 comments of cliYao
trafficstars

Array.from(new Set(arr.toString().split(",").sort((a,b)=>{ return a-b}).map(Number))) ![image](https://user-images.githubusercontent.com/38808449/56260289-3e570100-6109-11e9-886f-91998716ffc6.png)

> > 这里对上面的例子做一个扩展 > > ```js > > const promise = new Promise((resolve, reject) => { > > console.log(1); > > resolve(5); > > console.log(2); > > }).then(val => {...

> > > ### 为什么我老是喜欢投机取巧,哈哈 > > > ```js > > > var arr = [1,[2,3,[4,5]],8] > > > function flat (arr) { > > > return JSON.parse('[' + JSON.stringify(arr).replace(/\[|\]/g,...

function _new(fn , ...args){ const obj={} const Constructor = fn obj.__proto__ = Constructor.prototype const result = Constructor.call(obj , ...args) return typeof result === "object" ? result : obj }