for (let i = arr.length; i--;) {
const exists = arr.hasOwnProperty(i);
if (exists || !i) {
arr.length = i + exists;
break;
}
}
for (let i = arr.length; i-- && !(i in arr); arr.pop()) ;
str = str[0].toUpperCase() + str.slice(1);
// или
str = str.replace(/^./, m => m.toUpperCase());
// или
str = Array.from(str, (n, i) => i ? n : n.toUpperCase()).join('');
.main-footer__box:has(input:focus) label {
color: red;
}
const names = [ 'DIV', 'P', 'SPAN', ... ];
if (names.includes(el.nextSibling.nodeName)) {
...
-1
- добавить значение в массив, в противном случае - удалить:const active = [];
document.addEventListener('click', ({ target: t }) => {
const value = t.dataset['data-атрибут'];
if (value) {
const index = active.indexOf(value);
if (index === -1) {
active.push(value);
} else {
active.splice(index, 1);
}
}
});
document.addEventListener('click', ({ target: t }) => {
if (t.dataset['data-атрибут']) {
t.classList.toggle('active');
}
});
const active = Array
.from(document.querySelectorAll('.active'), n => n.dataset['data-атрибут'])
.join(', ');
key
с элементов .d_day
и .li_day
. Элементам .d_day
добавить общую обёртку, ей в качестве key
указать currentPage
. Заменить transition-group
на transition
. each val, index in [ ... ]
li
a(class=index == 0 ? 'active' : '')
const sourceKey = 'population';
const sourceVal = 2870528;
const targetKey = 'name';
const [ val ] = jp.query(cities, `$[?(@.${sourceKey} == ${sourceVal})].${targetKey}`);
const val = (cities.find(n => n[sourceKey] === sourceVal) || {})[targetKey];
'use strict';
Может кто то знает как решить эту проблему?