const presidents = [
{ first: 'George', last: 'Washington', born: 1732, died: 1799 },
{ first: 'John', last: 'Adams', born: 1735, died: 1826 },
{ first: 'Ronald', last: 'Reagan', born: 1911, died: 2004 },
];
let presidentsMap = presidents.map(item => ({first: item.first, last: item.last}));
console.log(presidentsMap) const arr = ['Jimmy', 'Rayn', 'Jack', 'Vladimir', 'joen'];
let res = arr.filter(el => /J/i.test(el[0]));
console.log(res); const candidate = ['Jimmy', 'Rayn', 'Jack', 'Vladimir', 'joen', ];
const friend = candidate.filter(item => item[0].match(/J/i))
console.log(friend) <div class="list">
<ul class="list__items current-list">
<li class="item">Egg - food</li>
<li class="item">Dog - animal</li>
<li class="item">Cat - animal</li>
<li class="item">Bread - food</li>
</ul>
<ul class="list__items new-list">
<!-- animal - список -->
</ul>
</div>document.querySelector('.new-list').innerHTML = [...document.querySelectorAll('.current-list li')].map(el => {
if(el.innerText.indexOf('animal') > -1) return `<li class="item">${el.innerText}</li>`;
}).join(''); @media (min-width: 320px) {
gap: calc(20px + 40 * (100vw - 320px) / 850);
}
@media (min-width: 1170px) {
gap: 60px;
}
const blockSelector = '.block';
const buttonSelector = `${blockSelector} .block__close`;document.addEventListener('click', e => {
e.target.closest(buttonSelector)?.closest(blockSelector).remove();
});document.querySelectorAll(buttonSelector).forEach(function(n) {
n.addEventListener('click', this);
}, e => e.currentTarget.closest(blockSelector).replaceWith()); .wrapper {
display: flex;
flex-direction: column;
justify-content: end;
width: 700px;
height: 150px;
}
.chat {
display: block;
overflow-y: scroll;
}