# Лайки

[**Ця задача на Codewars***:* **Who likes it?**](https://www.codewars.com/kata/who-likes-it/train/javascript)

Ви, ймовірно, знаєте систему «лайків» з Facebook та інших соціальних мереж. Люди можуть «лайкати» повідомлення в блозі, фотографії або пости. Ми хочемо створити текст, який повинен відображатись поряд з таким елементом.

Реалізуйте функцію `likes`, котра буде приймати вхідний масив, що містить імена людей, яким подобається елемент. І має повернути текст, як показано в прикладах:

```javascript
likes([]) // має повернути "no one likes this"
likes(["Peter"]) // має повернути "Peter likes this"
likes(["Jacob", "Alex"]) // має повернути "Jacob and Alex like this"
likes(["Max", "John", "Mark"]) // має повернути "Max, John and Mark like this"
likes(["Alex", "Jacob", "Mark", "Max"]) // має повернути "Alex, Jacob and 2 others like this"
```

Для чотирьох або більше імен в масиві виводяться тільки перші двоє імен і сума тих, що залишились.

*Перевірте рішення автотестами на сторінці самої задачі (і **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/likes.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.
