在javascript中传递对象内的变量

时间:2015-08-06 14:05:15

标签: javascript

我是javascript的初学者,我想知道为什么这不起作用?任何帮助将非常感激。浏览器抱怨:无法读取属性' size'未定义的

var settings = {

    size: {
            canvasWidth: 480,
            canvasHeight: 300,
            margin: {
                    top: 40,
                    bottom: 40,
                    left: 75,
                    right: 50
            },
            chartWidth: settings.size.canvasWidth - settings.size.margin.left - settings.size.margin.right
                ,
            chartHeight: settings.size.containerHeight - settings.size.margin.top - settings.size.margin.bottom

    }
}

0 个答案:

没有答案