亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

數組分組怎么弄...?

數組分組怎么弄...?

江戶川亂折騰 2019-02-13 14:20:33
有一串數組如下:var filelist = [{ name: 'a.html', path: 'src/app' }, { name: 'b.html', path: 'src/app' }, { name: 'c.html', path: 'src/app/com' }, { name: 'd.html', path: 'src/acc' }, { name: 'e.html', path: 'src/acc' }]如何使用JavaScript將其遍歷為文件樹的格式:如下    [{        title: 'src',        children: [{            title: 'app',            children: [{                title: 'a.html'            }, {                title: 'b.html',            }, {                title: 'com',                children: [{                    title: 'c.html'                }            }]        }, {            title: 'acc',            children: [{                title: 'c.html'            }, {                title: 'd.html',            }]        }]    }]├── src│   ├── app│      ├── index.html│      ├── a.html│      ├── com│         ├── b.html
查看完整描述

1 回答

  • 1 回答
  • 0 關注
  • 619 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號