Daily Challenge (245 Part Series)
We have a real challenge for you today - You are fighting against a monster and are strong enough to kill it with a few hits. But after every 3 punches you make, the monster hits you once. Your health is $h; number of monsters is $m, damage that monster can give you is $dm.
Write a function that will calculate: how many hits you received, how much damage you received and your remaining health. If your health is <= 0, you die and function should return "hero died".
killMonsters(100, 3, 33); // => "hits: 0, damage: 0, health: 100"
killMonsters(50, 7, 10); // => "hits: 2, damage: 20, health: 30"
Note: All numbers are strictly positive. Your function should always return a string.
Want to propose a challenge for a future post? Email firstname.lastname@example.org with your suggestions!
You're one click away
Level up every day