class Marine {
constructor(_damage, _armor) {
this.damage_g = _damage;
this.armor_g = _armor;
}
get damage() { return this.damage_g; }
set damage(value) { this.damage_g = value; }
get armor() { return this.armor_g; }
set armor(value) { this.armor_g = value; }
}
let marine = new Marine(10, 5);
alert(marine.damage_g)
marine.damage_g = 20;
alert(marine.damage_g)
let btns = document.querySelectorAll('.modal-open');
let modal = document.querySelectorAll('.modal');
const body = document.body
function open(el) {
el.classList.add('active');
}
function close(el) {
el.target.closest('.modal').classList.remove('active')
}
btns.forEach(btn => {
btn.addEventListener('click', (e) => {
let data = e.target.dataset.open;
modal.forEach(modals => {
if(modals.dataset.modal == data || modals.dataset.modal == e.target.closest('modal-open').dataset.open) {
open(modals)
}
})
} )
modal.forEach(modals => {
modals.addEventListener('click', e => close(e))
})
})