Javascript - Challenge
📖 Read the lesson
Code Life
By Pierre Marsaa
Battle Damage Calculator
Pyrochu attacks! Compute the real damage based on the opponent's type:
1.
Against
"plant"
: damage is doubled (super effective!)
2.
Against
"water"
: damage is divided by 2 (not very effective...)
3.
Against
"fire"
: damage is 0 (immune!)
4.
Any other type: normal damage
Store the result in
finalDamage
and print it.
↗️
Loading editor...
↶
▶️ Run
↷
💡 Show Solution
Continue