loading...

re: Daily Challenge #28 - Kill the Monster! VIEW POST

FULL DISCUSSION
 

Solution in javascript:

const killMonsters = (h, m, dm) => {
    const hits = Math.floor((m - 1) / 3);
    const damage = hits * dm;
    const health = h - damage;
    return health <= 0 ? 'Hero died' : `hits: ${hits}, damage: ${damage}, health: ${health}`;
}
code of conduct - report abuse