function displayPerso(hp,xp,lv){ document.getElementById("hp").innerHTML = hp; document.getElementById("lv").innerHTML = lv; document.getElementById("xp").innerHTML = xp; } function updatePerso(perso) { data.hp = perso.hp; data.xp = perso.xp; data.level = perso.lv; displayPerso(perso.hp, perso.xp, perso.lv); }