Skip to content

Instantly share code, notes, and snippets.

View o0's full-sized avatar
🎯
Focusing

Igor Alexeenko o0

🎯
Focusing
View GitHub Profile
// get All forms
const filtersForms = document.querySelectorAll(`.filter-form`);
// Create all filters
const filterByType = (type, arr) => arr.filter((car) => car.characteristics.type === type || type === `car-type-any`);
const filterByPower = (power, arr) => arr.filter((car) => car.characteristics.power >= +power || power === `power-all`);
const filterByFuel = (fuel, arr) => arr.filter((car) => car.characteristics.engine === fuel || fuel === `fuel-all`);
const filterByPrice = (price, arr) => arr.filter((car) => car.minPrice >= price);
const filterByClass = (carClass, arr) => arr.filter((car) => car.class === carClass);