How js traverses an array of arbitrary levels at any depth and converts it into html fragments

as the title

the real scene is that the chain store data of any depth and level given by the backend needs to be displayed on the page in the structure of a tree

related codes

let obj = {
  rst: "1",
  branch: [
    {
      rst: "2-1",
      branch: [
        {
          rst: "3-1",
          branch: [...]
        }
      ]
    },
    {
      rst: "2-2",
      brabch: [...]
    }
  ]
},
html;


const whatFunc = () = > {...};

expect results

whatFunc (); / / html assembly completed

Nov.11,2021
Menu