這裏用戶每次拿到最後一個屬性值選擇一些選項,節點對象,並將狀態,我需要一個最後一個節點對象的狀態後如何在JS對象
var breadCrumb = [{
breadCrumbN: {
node: {
state: "test",
node: {
state: "test^test2",
node: {
state: "test^test2^test3",
node: {
state: "test^test2^test3^test4" // like to post the last state. the node object will be added for each selection
}
}
}
}
}
}]
看起來你正在尋找樹的遍歷,如果你知道那是什麼。 – Andrew
所以,你需要繼續遍歷,直到你用完'node'屬性並且只剩下'state'屬性? – gurvinder372