x = x * 0.9 //оставить 90%, то есть по сути отнять 10%
x = x - 0.1 * x //от х отнять 10%
a = a - 1 // тоже самое, что a -= 1
percent.style.width = (parseInt(percent.style.width) - 50) + 'px';
{
"enabled_plugins": [
"SimpleReloadPlugin",
"SimpleRefresh"
]
}
<label class="button">
<input type="radio" name="button">
<span>click me</span>
</label>
<label class="button">
<input type="radio" name="button">
<span>click me</span>
</label>
.button input {
display: none;
}
.button input:checked + span {
background: red;
color: white;
}
// Только для примера, в жизни для этой задачи использовать .map
[1, 2, 3].reduce((acc, el) => [...acc, el ** 2], [])
const o = {
importantField: “value”,
some: true,
random: false,
stuff: null
}
const { importantField, ...someRandomStuff } = o
// Не совсем тоже самое, но спред используется и здесь
function variadicFn(singleArg, ...arrayWithTheRestOfArgs) {}
const condition = true
const p = { ...condition && { text: “Contion is truthful” } }
Почему так ?
document.querySelectorAll(...)
возвращает NodeList массив, у которого нет свойства textContentvar text = [];
[...document.querySelectorAll("p")].map(v => text.push(v.textContent))
// В элементах массива text будет лежать контент всех найденных абзацев