# Object

{% embed url="<https://learn.javascript.ru/object>" %}

## Розмір об’єкту

`Object.keys()` метод, який повертає масив, що представляє всі властивості об'єкта. Якщо об'єкт порожній, довжина масиву, що повертається дорівнює `0`.

```javascript
var obj = { one : 1, two : 2, three : 3 };
 
var length = Object.keys(obj).length;
console.log(length);
```

## Перебір елементів об’єкту

<pre class="language-javascript"><code class="lang-javascript"><strong>let json_obj = 	
</strong>{
    "113": {
        "name":"Анемометр чашковий ручний МС-13",
        "list":["666","777"]
    },
    "119": {
        "name":"Гігрометр метеорологічний М-19",
        "list":["123","234","345"]
    }
};

</code></pre>

```javascript
for (let key in json_obj)                  // перебір ключів хешу
{
    console.log(json_obj[key].name);
    for (let i in json_obj[key].list)      // перебір елементів масиву
        console.log(json_obj[key].list[i]);
}
```

```
113.Анемометр чашковий ручний МС-13
666
777
119.Гігрометр метеорологічний М-19
123
234
345
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://olexsyn.gitbook.io/enote/progr/javascript/object.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
