const values = Array.from(
document.querySelectorAll('.aside input[type="checkbox"]:checked'),
n => n.value
);
Почему console.log('\n' == separator.value);
возвращает false?
\n
- это перенос строки. Экранируйте слэш - '\\n' == separator.value
. const steps = Object.entries(answers).reduce((acc, [ key, val ]) => {
const question = questions.find(n => n.key === key);
const step = acc[val.step] = acc[val.step] || [];
step.push({
step: val.step,
question: { ...question.question },
answer: question.answer.values instanceof Object
? question.answer.values[val.answer].en
: val.answer,
});
return acc;
}, {});
const arr = JSON.parse(localStorage.getItem('arr')) || [];
arr.push(1, 2, 3);
localStorage.setItem('arr', JSON.stringify(arr));
const lowered = str.toLowerCase();
const filtered = data.filter(n => !n.name.toLowerCase().indexOf(lowered));
const filtered = data.filter(function(n) {
return n.name.toLowerCase().startsWith(this);
}, str.toLowerCase());
const filtered = data.filter(((reg, n) => reg.test(n.name)).bind(null, RegExp(`^${str}`, 'i')));
чтобы числа повторялись не более двух раз
SELECT *, price * ((100 - discount) / 100) AS discounted
FROM prices
ORDER BY discounted
LIMIT 10
$(document).on({
focus() {
$(this).addClass('active-amount-input');
},
blur() {
$(this).removeClass('active-amount-input');
},
}, '.amount, .amount_1');
$(document).on('focusin focusout', '.amount, .amount_1', e => {
$(e.currentTarget).toggleClass('active-amount-input', e.type === 'focusin');
});
- <main className={active ? 'move-to-left' : ''}>
+ <main>
- <div className="sidebar">
+ <div className={'sidebar ' + (active ? 'move-to-left' : '')}>
- <NavRight onClick={this.toggleActive} buttonClass={!active ? 'active' : ''} navClass="hidden-xs" />
+ <NavRight onClick={this.toggleActive} buttonClass={active ? 'active move-to-left' : ''} navClass="hidden-xs" />
+ body {
+ overflow: hidden;
+ }
.sidebar {
...
- z-index: 1;
- right: 0;
+ z-index: 3;
+ right: -400px;
+ transition: all .7s ease;
Имелось в виду, что контент тоже двигается при смещении sidebar, но не убегает полностью в левый угол, а остается по центрy оставшейся ширины