【发布时间】:2011-01-19 01:57:04
【问题描述】:
我需要一个可以通过以下方式访问的示例 js 对象字面量:
hist.undo[0].operation[0].x // would print '2' or whatever
hist.undo[0].operation[0].y // would print '21' or whatever
// [...]
hist.undo[2].operation[0].x // would print '32' or whatever
hist.undo[2].operation[0].y // would print '12' or whatever
谢谢!
【问题讨论】:
-
@Toader Mihai Claudiu - 不。我是 JSON 新手,无法创建对象。
-
这篇文章可能会帮助你更好地理解 JavaScript 对象stackoverflow.com/questions/1704618/…
标签: javascript json object literals