Simonduya

Results 4 comments of Simonduya

```js function flattenTree(tree, result = []) { for (const node of tree) { const { children, ...rest } = node; console.log(rest); result.push(rest); if (children && children.length > 0) { flattenTree(children,...

```js function numIslands(grid) { let count = 0; function dfs(i, j) { if (i < 0 || j < 0 || i >= grid.length || j >= grid[0].length || grid[i][j]...

```js // promise.all会返回一个新的promise,当promise数组中所有的promise都成功才resolve, 而只要其中一个失败就直接reject失败的结果 const p1 = new Promise((resolve, reject) => { setTimeout(() => { resolve(111); }, 2000); }); const p2 = new Promise((resolve, reject) => { setTimeout(() => {...

```html Document const jump = () => { alert(666); }; const vnode = { tags: "div", props: { id: "box", style: "width:100px; color:red", }, children: [ { tags: "a", props:...