Warning: mkdir(): No space left on device in /var/www/tgoop/post.php on line 37

Warning: file_put_contents(aCache/aDaily/post/frontendInterview/--): Failed to open stream: No such file or directory in /var/www/tgoop/post.php on line 50
Frontend Interview - собеседования по Javascript / Html / Css@frontendInterview P.4163
FRONTENDINTERVIEW Telegram 4163
Two fighters, one winner.

Создайте функцию, которая возвращает имя победителя в бою между двумя бойцами. Каждый боец по очереди атакует другого, и побеждает тот, кто первым убьет другого. Смерть определяется как health <= 0.

Каждый боец будет объектом/экземпляром Fighter. Смотрите ниже класс Fighter на выбранном вами языке.

health и damagePerAttack за атаку будут целыми числами, большими 0. Вы можете мутировать объекты Fighter.

Ваша функция также получает третий аргумент - строку с именем бойца, который атакует первым. Пример:

declare_winner(Fighter("Lew", 10, 2), Fighter("Harry", 5, 4), "Lew") => "Lew"

Lew attacks Harry; Harry now has 3 health.
Harry attacks Lew; Lew now has 6 health.
Lew attacks Harry; Harry now has 1 health.
Harry attacks Lew; Lew now has 2 health.
Lew attacks Harry: Harry now has -1 health and is dead. Lew wins.


function Fighter(name, health, damagePerAttack) {
this.name = name;
this.health = health;
this.damagePerAttack = damagePerAttack;
this.toString = function() { return this.name; }
}


👉 @frontendInterview



tgoop.com/frontendInterview/4163
Create:
Last Update:

Two fighters, one winner.

Создайте функцию, которая возвращает имя победителя в бою между двумя бойцами. Каждый боец по очереди атакует другого, и побеждает тот, кто первым убьет другого. Смерть определяется как health <= 0.

Каждый боец будет объектом/экземпляром Fighter. Смотрите ниже класс Fighter на выбранном вами языке.

health и damagePerAttack за атаку будут целыми числами, большими 0. Вы можете мутировать объекты Fighter.

Ваша функция также получает третий аргумент - строку с именем бойца, который атакует первым. Пример:

declare_winner(Fighter("Lew", 10, 2), Fighter("Harry", 5, 4), "Lew") => "Lew"

Lew attacks Harry; Harry now has 3 health.
Harry attacks Lew; Lew now has 6 health.
Lew attacks Harry; Harry now has 1 health.
Harry attacks Lew; Lew now has 2 health.
Lew attacks Harry: Harry now has -1 health and is dead. Lew wins.


function Fighter(name, health, damagePerAttack) {
this.name = name;
this.health = health;
this.damagePerAttack = damagePerAttack;
this.toString = function() { return this.name; }
}


👉 @frontendInterview

BY Frontend Interview - собеседования по Javascript / Html / Css




Share with your friend now:
tgoop.com/frontendInterview/4163

View MORE
Open in Telegram


Telegram News

Date: |

Public channels are public to the internet, regardless of whether or not they are subscribed. A public channel is displayed in search results and has a short address (link). During the meeting with TSE Minister Edson Fachin, Perekopsky also mentioned the TSE channel on the platform as one of the firm's key success stories. Launched as part of the company's commitments to tackle the spread of fake news in Brazil, the verified channel has attracted more than 184,000 members in less than a month. The best encrypted messaging apps Choose quality over quantity. Remember that one high-quality post is better than five short publications of questionable value. Select: Settings – Manage Channel – Administrators – Add administrator. From your list of subscribers, select the correct user. A new window will appear on the screen. Check the rights you’re willing to give to your administrator.
from us


Telegram Frontend Interview - собеседования по Javascript / Html / Css
FROM American