var part = parseInt("1");
Без комментариев.Array.prototype.forEach.call()
. Или создать массив Array.from(qInputs).forEach()
.this.hasAttribute('data-max-quantity') == true
. Тоже оставлю без комментариев.console.log(parseFloat((0.2 + 0.1).toFixed(3))); // 0.3
console.log(parseFloat((0.21 + 0.14).toFixed(3))); // 0.35
console.log(Number(Math.round((0.2 + 0.1)+'e'+3)+'e-'+3));
console.log(Number(Math.round((0.21 + 0.14)+'e'+3)+'e-'+3));
console.log(Math.round((0.2 + 0.1) * 100) / 100);
console.log(Math.round((0.21 + 0.14) * 100) / 100);
const student = {
name : 'Sasha',
age : 46,
surname: 'Belov',
};
const studentCS = { ...student };
studentCS.speiality = 'Computer Science';
const courses = {
Math : 10,
English: 9,
Sport : 8,
};
const permissions = {
canView : true,
canEdit : false,
canPrint: true,
};
Object.assign(studentCS, courses, permissions);
console.log(studentCS);
studentCS.average = function () {
return (this.Math + this.Sport + this.English) / 3;
};
studentCS.checkPermission = function () {
return [
this.canView,
this.canEdit,
this.canPrint,
].filter(i => i).length;
};
console.log('Score: ' + studentCS.average());
console.log('Number of enabled rights: ' + studentCS.checkPermission());
const servicesList = document.querySelector('.services__сategory');
const activeClass = "active-category";
servicesList.addEventListener("click", function(event) {
const element = event.target.closest(".category-item");
if (!element) return;
const activeElement = element.parentElement.querySelector(".active-category");
if (element !== activeElement) {
activeElement.classList.remove(activeClass);
element.classList.add(activeClass);
}
});