const div = document.createElement('div');
div.innerHTML = str;
const arr = Array.prototype.map.call(div.children, n => n.outerHTML);
const arr = Array.from(
new DOMParser().parseFromString(str, 'text/html').body.children,
n => n.outerHTML
);
const arr = [];
for (const n of document.createRange().createContextualFragment(str).children) {
arr.push(n.outerHTML);
}
let number = 0b1101;
const count = [ 0, 0 ];
do {
count[number & 1]++;
} while (number >>= 1);
count.forEach((n, i) => console.log(`${i}: ${n}`));
const count = [...number.toString(2)].reduce((acc, n) => (++acc[n], acc), [ 0, 0 ]);
string s = " qwerty\n\
asdfgh\n\
zxcvbn";
string s = R"( qwerty
asdfgh
zxcvbn)";
У меня 2 предположения:
1. Я что-то делаю не так
2. Я не хорошо ознакомился с Vuex...
По сути у меня два компонента получилось upload-files и edit-file . И надо теперь наладить между ними взаимодействие.
var lastCharacter = ';';
$('input').on('input', function() {
var val = this.value;
if (val && val[val.length - 1] !== lastCharacter) {
$(this).val(val + lastCharacter);
}
});
я что-то не так делаю видно
<div class="container">
<input maxlength="10">
</div>
const container = document.querySelector('.container');
const input = container.querySelector('input').cloneNode();
container.addEventListener('input', ({ target: t }) => {
if (t.value.length === +t.maxLength) {
const nextInput = t.nextElementSibling || input.cloneNode();
t.insertAdjacentElement('afterend', nextInput);
nextInput.focus();
}
});