return state["users"].entities.forEach(user => { if (user.email === state["auth"].user.email) { return user; } });
return state.users.entities.find(user => user.email === state.auth.user.email);
const rows = 3;
const cols = 5;
const max = 10;
const arr =
Array.from({ length: rows }, () =>
Array.from({ length: cols }, () =>
Math.random() * max | 0
)
);
const sumRows = arr.map(n => n.reduce((acc, m) => acc + m, 0));
const sumCols = (arr[0] || []).map((n, i) => arr.reduce((acc, m) => acc + m[i], 0));
// или
const [ sumRows, sumCols ] = arr.reduce((acc, n, i) => (
n.forEach((m, j) => (acc[0][i] += m, acc[1][j] += m)),
acc
), [ rows, cols ].map(n => Array(n).fill(0)));
интересуют только кастомные маркеры...
...и блоки с описанием этих маркеров
.label-text
переключайте класс у максимально дальних не общих предков input'ов, т.е., у .thumb
. Соответственно, стилизовать надо будет не .label-text.класс
, а .класс .label-text
. Зачем делать именно так? Потому что не придётся переписывать js-код, если вдруг вам завтра захочется кроме .label-text
стилизовать ещё что-то, или решите изменить взаимное расположение элементов.const containerSelector = '.thumb';
const inputSelector = 'input[id^="input-"]';
const activeClass = 'active';
$(containerSelector).on('input', inputSelector, function(e) {
$(e.delegateTarget).toggleClass(activeClass, !!this.value);
});
const onInput = ({ target: t, currentTarget: ct }) =>
t.matches(inputSelector) && ct.classList.toggle(activeClass, !!t.value);
document.querySelectorAll(containerSelector).forEach(n => {
n.addEventListener('input', onInput);
});
<li class="sidebar__item" v-for="(category, index) in sidebarList.cat">
<h2 class="sidebar__title" @click="active = active === index ? null : index">{{ category }}</h2>
<ul class="submenu" v-if="active === index">
renderContent = (arr, id) => {
return Object.values(arr.delete(id).map(item => <li key={item.id}>{item.name}</li>).toJS())
}
for (let j = 1; j <= this.players; j++) {
this.card.dataset.playerId = j; // а тут устанавливаем playerId. Но он у меня постоянно одинаковый
}
this.card.dataset.playerId = i <= this.players ? i : ((Math.random() * this.players | 0) + 1);
UPDATE test SET
target_id = t.new_id
FROM (
SELECT
unnest(ARRAY[1206, 1210, 1211, 1250]) AS old_id,
unnest(ARRAY[1281, 1282, 1283, 1287]) AS new_id
) AS t
WHERE target_id = t.old_id