napi_get_array_length


napi_status napi_get_array_length(napi_env env,
                                  napi_value value,
                                  uint32_t* result) 
  • [in] env:调用 API 的环境。

    ¥[in] env: The environment that the API is invoked under.

  • [in] valuenapi_value 代表查询长度的 JavaScript Array

    ¥[in] value: napi_value representing the JavaScript Array whose length is being queried.

  • [out] resultuint32 代表数组的长度。

    ¥[out] result: uint32 representing length of the array.

如果 API 成功,则返回 napi_ok

¥Returns napi_ok if the API succeeded.

此 API 返回数组的长度。

¥This API returns the length of an array.

Array 长度在 ECMAScript 语言规范的 第 22.1.4.1 节 中描述。

¥Array length is described in Section 22.1.4.1 of the ECMAScript Language Specification.