# Масив овець

[**Ця задача на Codewars: Counting sheep...**](https://www.codewars.com/kata/counting-sheep-dot-dot-dot/train/javascript)

Розглянемо масив овець, в якому деякі вівці можуть бути відсутніми на своєму місці. Нам потрібна функція, яка підраховує кількість овець, які присутні в масиві (true означає, що присутня).

Наприклад:

```javascript
[true,  true,  true,  false,
true,  true,  true,  true ,
true,  false, true,  false,
true,  false, false, true ,
true,  true,  true,  true ,
false, false, true,  true]
```

Правильна відповідь буде 17.

**Підказка**: не забудьте перевірити наявність некоректних значень, таких як null / undefined.

*Перевірте рішення автотестами на сторінці самої задачі (і **Test**, і **Attempt**).*\
*Про всяк випадок, ось* [*інструкція з Codewars*](/zero/tutorials/codewars.md)*.*

{% hint style="warning" %}
**Увага**! На Сodewars можна самостійно перевірити, чи правильно працює код. А нюанси стилю можна зрозуміти, порівнюючи своє рішення із чужими. Тому **волонтери не рев'ювають задачі з Сodewars.**
{% endhint %}

*Виникли питання або труднощі?* [*Зверніться за допомогою до Ш++.*](/zero/arrangements/support.md)


---

# 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://shpp.gitbook.io/zero/tutorials/codewars/sheeps-array.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.
