简体   繁体   English

带有对象文字的javascript数组的名称是什么?

[英]What is a the name for a javascript array mixed with an object literal?

I'm quite new to Javascript, and I'm trying to develop an application using Google Maps. 我刚接触Javascript,现在正在尝试使用Google Maps开发应用程序。

I came across this class in Google Maps called GeocoderResults , with documentation here . 我在Google Maps中遇到了称为GeocoderResults此类, 此处提供了文档

In the documentation, it says that a results object is passed in the following form: 在文档中,它表示results对象以以下形式传递:

地理编码器表格

However, in all the material I've read and searched on Javascript, the closest thing this looks like is an object literal . 但是,在我阅读过的有关Javascript的所有材料中,看起来最接近的是object literal The problem is it lacks an equals sign and it's name, results[] represents an array! 问题是它缺少等号,它的名称是results[]表示数组!

It must be some type of structure I've never seen before. 这一定是我从未见过的某种结构。

Can someone explain it? 有人可以解释吗?

This itself is not an object literal. 这本身不是对象文字。 It is merely a type information about what fields the result (which will be an actual object literal) will contain and how they look. 这仅仅是关于结果将包含哪些字段(将是实际的对象文字)及其外观的类型信息。 Each of the fields is explained below that in the documentation. 每个字段的说明如下。

The actual result will look like 实际结果看起来像

{
    results: [
        {
            types: [
                "…",
                …
            ],
            formatted_address: "…",
            address_components: [
                {…},
                …
            },
            partial_match: false,
            geometry: {…}
        },
        …
    ],
    status: "…"
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM