let hp, mp, hit;
json.hp
json.mp
json.hit
jsonCollection.forEach(function(iter) { console.write(iter); });
jsonCollection.forEach(function(iter) { console.write(iter); });
jsonCollection.forEach(function(iter) { console.write(iter); });
let timer = {};
let user = ['hp', 'mp', 'hit'];
user.forEach(function (element) {
clearInterval(timer[element]);
$('#' + element).html(parseInt(json[element]));
if (parseInt(json[element]) < parseInt(json[element + '_max'])) {
let now = parseFloat(json[element]);
timer[element] = setInterval(function () {
now += parseFloat(json[element + '_reg']);
if (parseInt(now) === parseInt(json[element + '_max'])) clearInterval(timer[element]);
$('#' + element).html(parseInt(now));
}, 1000);
}
});
{hp: 3, mp: 4, hit: 5}
{hp: 3, mp: 4, hit: 5}
jsonCollection.forEach(function(iter) { console.write(iter); });
jsonCollection.forEach(function(iter) { console.write(iter); });