xiansheng lu

Results 58 comments of xiansheng lu

Sorry for not maintaining that. Perhaps, issue is enough?

Questions: 1. [typescript intersection types of function](https://stackoverflow.com/questions/66493902/typescript-intersection-types-of-function) 2. [typescript: Using infer with never get different result](https://stackoverflow.com/questions/66469909/typescript-using-infer-with-never-get-different-result) 3. [Typescript infer generic param types with union](https://stackoverflow.com/questions/66399533/typescript-infer-generic-param-types-with-union) 4. https://github.com/microsoft/TypeScript/issues/39787

Can we put the duplicate code to _app.js_ so it won't be duplicate? It's not the best idea but it is better than that each split has a copy?

```js // use arrow function to keep this const mouseDownCb = event => { // ensure the click is triggered by left click if (event.button !== 0) { return }...

```js // Problem #1 // factorial(5) 5 * 4 * 3 * 2 * 1 // factorial(3) 3 * 2 * 1 let factorial = function f (num) { if...

Conclusion: Normally, loop and recursion can be transformed. What they both have is: * a condition to stop loop or recursion * another condition to keep loop and recursion The...

https://stackoverflow.com/questions/53846100/convert-json-object-to-object-which-not-in-json-format#53846100 ```js function iterate(obj,prevKeys=[],result=[]){ if(Date.now()-s>1000){return;} let keys=Object.keys(obj) keys.forEach((key)=>{ if(typeof obj[key]!=='object'){ result.push(prevKeys.concat(key)) return } return iterate(obj[key],prevKeys.concat(key),result) },[]) return result } var s=Date.now() console.log(iterate(inputObj)) ```

For example, if there is a variable: ```js let a ``` This is a bad practice. The good choice would be: ```js let str='' ``` or ```js let count=0 ```...

https://stackoverflow.com/questions/53393356/better-way-to-save-js-object-state

https://jakearchibald.com/2015/tasks-microtasks-queues-and-schedules/ 这篇文章里讲清楚了