I'm new into this but basically I'm trying to make a JavaScript loop, where 2 fighters fight. I made an array with the 2 fighters and a button connected to my JavaScript from HTML. Now I need to make a loop where the fighters hit each other where the damage by 1 fighter is subtracted by the health of the other so on, later I need to display how the fight went in my html. but I don't know where to start I would be thankful for some help. This is what I have done and I don't know what to do after or if it is even right?
var fighters = [
{
"name":"Abdi",
"HP": 100,
"DMG": 20,
}
{
"name": "chriz",
"HP": 100,
"DMG": 11,
}
]
function myFunction() {
for (var i = 0; i < fighters.length; i++) {
fighters[i]
}
}