document.addEventListener("keydown", function (evt) {
if (evt.code === "Tab" && evt.target === someElement)
doStuff();
});
const Products = ({products, filters}) => {
const filteredProducts = products.filter((product) => {
const currentFilter = filters.promotion.find((filter) => product.id === filter.id);
if (!currentFilter) return true; // or do something else
if (!product.hasOwnProperty(currentFilter.name)) return true;
return product[currentFilter.name] === currentFilter.value;
});
return (
<>
{filteredProducts.map(...)}
</>
);
}
const renderPageNumber = (number) => {
const nextIcons = Array(number)
.map((icon, id) => <NextIcon i={id + 1} key={?} />);
return nextIcons;
}
const urls = [...]
let items = document.querySelectorAll(".grid .item");
items.forEach(function (el, id) {
el.innerHTML = `
<svg viewBox="0 0 155 219" xmlns="http://www.w3.org/2000/svg">
<defs>
<mask id="mask">
<rect width="100%" height="100%" fill="black"></rect>
<circle cx="80" cy="120" r="60" fill="white" stroke="#c00" stroke-width="10" />
<circle cx="50" cy="60" r="40" fill="white" stroke="#c00" stroke-width="10" />
</mask>
</defs>
<image href=" ${urls[id]} " width="100%" height="100%" x="0" y="0"
preserveAspectRatio="none" mask="url(#mask)"/>
</svg>
`;
});
...
return [[BLACK_LIST]].indexOf(e) < 0
...
[[LIST_WITH_FILE_CONTENT]] = [[LIST_WITH_FILE_CONTENT]].filter(function(line){
return [[BLACK_LIST]].every(function(forbiddenWord) {
return !line.includes(forbiddenWord); // или line.indexOf(forbiddenWord) === -1;
});
});