跳至主要內容
  • Hostloc 空間訪問刷分
  • 售賣場
  • 廣告位
  • 賣站?

4563博客

全新的繁體中文 WordPress 網站
  • 首頁
  • 求助大佬呀
未分類
22 9 月 2020

求助大佬呀

求助大佬呀

資深大佬 : xiaoniuniu 0

/** 编写一个 js 方法根据输入实现输出 将 arr 转化为树形结构 treeObj 节点的 outputs 为下一节点的 inputs */

例子: // 输入 const arr = [{ name: ‘test1’, outputs: [1,2], inputs: [] }, { name: ‘test2’, outputs: [3], inputs: [1] }, { name: ‘test3’, outputs: [4], inputs: [2] }, { name: ‘test4’, outputs: [5], inputs: [3,4] }, { name: ‘test5’, outputs: [], inputs: [5] }] // 输出 const treeObj = { name: ‘test1’, outputs: [1,2], inputs: [] children: [{ name: ‘test2’, outputs: [3], inputs: [1], children: [{ name: ‘test4’, outputs: [5], inputs: [3,4], children: [{ name: ‘test5’, outputs: [], inputs: [5], children: null }] }] }, { name: ‘test3’, outputs: [4], inputs: [2], children: [{ name: ‘test4’, outputs: [5], inputs: [3,4], children: [{ name: ‘test5’, outputs: [], inputs: [5], children: null }] }] }] }

大佬有話說 (2)

  • 資深大佬 : xiaoming1992

    格式化都不做一下,太不上心了

  • 資深大佬 : tang123456

    这咋看?

文章導覽

上一篇文章
下一篇文章

AD

其他操作

  • 登入
  • 訂閱網站內容的資訊提供
  • 訂閱留言的資訊提供
  • WordPress.org 台灣繁體中文

51la

4563博客

全新的繁體中文 WordPress 網站
返回頂端
本站採用 WordPress 建置 | 佈景主題採用 GretaThemes 所設計的 Memory
4563博客
  • Hostloc 空間訪問刷分
  • 售賣場
  • 廣告位
  • 賣站?
在這裡新增小工具