This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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); |
OlderNewer