function split(arr, numParts) {
const partSize = arr.length / numParts | 0;
return Array
.from({ length: numParts }, (n, i) => i * partSize)
.map((n, i, a) => arr.slice(n, a[i + 1]));
}
function split(arr, numParts) {
const partSize = arr.length / numParts | 0;
const numLooseItems = arr.length % numParts;
return Array.from(
{ length: numParts },
function(_, i) {
return arr.slice(this(i), this(i + 1));
},
i => i * partSize + Math.min(i, numLooseItems)
);
}
Please provide an email response specifically identifying the country in which the [Product Name] Software is developed and maintained.В письме укажите свою страну...
If the country of origin is outside the United States, please provide any information you may have stating that testing is performed in the United States prior to supplying products to customers....скажите, что вы никакого тестирования в США не проводили, а про других ничего не знаете...
Additionally, if available, please identify all authorized resellers of the product in question....поскольку ПО свободное, никто его не перепродаёт...
Lastly, please confirm that the product(s) in question is not manufactured by, contain critical components developed by, or receive substantial political or monetary influence from entities prohibited by Section 889 of the 2019 NDAA....никакую из перечисленных компаний вы не знаете и денег от них не получали.
Как исправить баг?
class Scrolling {
offset = null;
scrolls() {
const isOffset = pageYOffset > 100 ? "offsetOne" : "offsetSecond";
if (this.offset != isOffset) {
this[isOffset]({
registion: document.querySelector("#registion"),
vhod: document.querySelector("#vhod"),
});
this.offset = isOffset;
}
}
offsetOne({ registion, vhod }) {
registion.style.display = "none";
vhod.style.cssText = "background:none;width:30px";
vhod.innerHTML = "<img style='width: 20px; height: 20px;' src='SiteImage/logo_vhod.svg'>";
PanelMenuLinks.style.cssText = "background:none;z-index:-1;margin-top:-45px;font-size:13px;color:#fff;border-top:0;";
block_panel_menu_children.style.top = "10px";
//block_panel_menu - заменить на класс.
document.querySelectorAll("#block_panel_menu").forEach((item) => (item.style.height = "49px"));
document.querySelector("#logotip").style.cssText = "opacity: 0;margin-top:-20px;";
document.querySelector("header").style.height = "50px";
}
offsetSecond({ registion, vhod }) {
registion.style.display = "block";
vhod.style.cssText = "background:#626262;width:100px";
vhod.innerHTML = "Регистрация";
PanelMenuLinks.style.cssText = "background:#E7E7E7;margin-top:0px;font-size:18px;color:#000;border-top:10px solid #fff;";
block_panel_menu_children.style.top = "20px";
//block_panel_menu - заменить на класс.
document.querySelectorAll("#block_panel_menu").forEach((item) => (item.style.height = "70px"));
document.querySelector("#logotip").style.cssText = "opacity:1;margin-top:0px;";
document.querySelector("header").style.height = "70px";
}
}
const scroll = new Scrolling();
window.addEventListener("scroll", scroll.scrolls.bind(scroll), false);
Как избегать foreach внутри foreach?
Очень часто вижу на разных форумах, в коммах в вк и тд юзать цикл внутри цикла не правильно
Каким образом можно сделать это по другому(правильно) ?
var imageFromInternet = GetImageByUrl("http://example.com/big-image.bmp");
picture.image = imageFromInternet;
const getMinimumUniqueSum = arr => [...arr]
.sort((a, b) => a - b)
.reduce((acc, n) => (acc[1] += acc[0] = Math.max(acc[0] + 1, n), acc), [ -Infinity, 0 ])
.pop();