Current object property as value in same object different property

前端 未结 3 1106
暗喜
暗喜 2020-12-22 03:48

Sorry for such a random title, but have no idea how to explain it better. And therefore, no idea if this is a duplicate question or not.

So, when declaring a new ob

3条回答
  •  梦毁少年i
    2020-12-22 04:27

    var myObject = {
        super : 1,
        mega : 5,
        uber : 100
    };
    myObject.giga = myObject.super + myObject.mega + myObject.uber;
    

提交回复
热议问题