event и сбрасываем его.menuToggle.addEventListener('click', function (event) {
event.preventDefault();
...
});this меняем на menuToggle.<button class="menu-toggle" id="menu-toggle">
<span class="menu-toggle__span"></span>
</button>.menu-toggle {
width: 60px;
height: 60px;
padding: 0;
border: none;
display: flex;
justify-content: center;
align-items: center;
background: none;
z-index: 15;
}
.menu-toggle.active .menu-toggle__span {
background-color: transparent;
}
.menu-toggle.active .menu-toggle__span:before {
transform: rotate(45deg);
top: 0;
}
.menu-toggle.active .menu-toggle__span:after {
transform: rotate(-45deg);
top: 0;
}checkbox'а внутри «кнопки».
array.reduce((accumulator, value, index) => {
if (!(accumulator[index % 2] instanceof Array)) {
accumulator[index % 2] = [];
}
accumulator[index % 2].push(value);
return accumulator;
}, []);array.reduce((accumulator, value, index) => {
accumulator[index % 2].push(value);
return accumulator;
}, [[], []]);array.reduce((accumulator, value, index) => (accumulator[index % 2].push(value), accumulator), [[], []]);array.reduce((a, v, i) => (a[i % 2].push(v), a), [[], []]);const countOff = (array, count) => array.reduce((accumulator, value, index) => {
accumulator[index % count].push(value);
return accumulator;
}, Array.from({ length: count }, () => []));
countOff([1, 2, 3, 4, 5, 6], 2); // [[1, 3, 5], [2, 4, 6]]
countOff([1, 2, 3, 4, 5, 6], 3); // [[1, 4], [2, 5], [3, 6]]
Math.pow уже не работает?const pow = (number, power) => {
if (number === 1 || power === 0) {
return 1;
}
const count = Math.round(Math.abs(power));
let result = number;
for (let index = 0; index < count - 1; index++) {
result *= number;
}
if (power < 0) {
return 1 / result;
} else {
return result;
}
};
console.log(Math.pow(2, 2) === pow(2, 2)); // true
console.log(Math.pow(2, -2) === pow(2, -2)); // true
console.log(Math.pow(2, -3) === pow(2, -3)); // true
console.log(Math.pow(3, -4) === pow(3, -4)); // truefunction mynumber(a, b) {
var c = 1;
if (b < 0) {
for (var i = b; i < 0; i++) {
c /= a;
}
} else {
for (var i = 1; i <= b; i++) {
c *= a;
}
}
return c;
}
{
"rewrap.wholeComment": false
} и разрыв между комментариями делаете, либо выделяете то, что надо отформатировать.
href у ссылок выглядит так: #some?, а знака вопроса не должно быть после хэша.
const total = array.reduce((acc, entry) => {
acc += entry.price;
return acc;
}, 0);
The storage event of the Window interface fires when a storage area (localStorage or sessionStorage) has been modified in the context of another document.