var jsonObj = [
{
id: 1,
name: "",
path: "/dashboard",
children: []
},
{
id: 2,
name: "",
path: "/auth",
children: [
{
id: 3,
name: "",
path: "/auth/role",
children: [
]
}
]
}
]
var pathStr = "/auth/role/list"
have the above two variables jsonObj and pathStr,. If there is a path attribute in jsonObj that has the same value as pathStr, then return pathStr,. If it is not the same, find the one that is closest to pathStr. For example, in this case, the final return is"/ auth/role"
.