js递归循环数组

当我们从后台获取回来的数据是一个数组时,而且每个元素是一个对象,对象的层级不确定,需要使用递归循环遍历所有的子元素

var tdata=[
  {
    "code": "has Value Domain Member",
    "value": "未婚",
    "properties": [
      {
        "code": "MDM VD Member PKID",
        "value": "4055",
        "properties": [
          {
            "code": "MDM VD Member PKID",
            "value": "4055",
            "properties": []
          }
        ]
      }
    ]
  },
  {
    "code": "MDM VD Member Name",
    "value": "未婚"
  },
  {
    "code": "MDM VD Member ObjectID",
    "value": "10"
  },
  {
    "code

本文链接:https://my.lmcjl.com/post/1508.html

展开阅读全文

4 评论

留下您的评论.