gpt4 book ai didi

javascript - 如何在javascript中使用 "with"构造?

转载 作者:行者123 更新时间:2023-11-29 18:17:49 27 4
gpt4 key购买 nike

<分区>

我有这个代码:

var home = {}
home.table={}
home.table.width = 100
home.table.length = 200
home.table.weight = 20
home.table.material = "wood"
home.table.color = "brown"

我怎样才能正确使用结构 with (object) {code} 来得到这样的东西?

var home = {}
with (home) {
table = {}
table.width = 100
table.length = 200
table.weight = 20
table.material = "wood"
table.color = "brown"
}

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com