将对象值用作同一对象内的新值

时间:2017-08-10 10:30:16

标签: javascript object

我有以下对象:

obj = 
config {
    commonId: "id-goes-here",
    option1 : {
        value : "",
        link : "some-link/" + commonId should go here
    },
    option2 : {
        value : "",
        link : "some--other-link/" + commonId should go here
    },
    option3 : {
        value : "",
        link : "link/" + commonId should go here
    },
}

如何引用在同一对象中声明的commonId?我不认为重复相同的ID是好习惯..

0 个答案:

没有答案