function isLong(city){ return city.length >8; }
const cities = ['London','Liverpool','Totnes','Edinburgh'];
const longer = cities.filter(isLong);
console.log(longer);
VM1941:1 (2) ['Liverpool', 'Edinburgh']
const test = cities.map(isLong);
console.log(test);
VM2112:1 (4) [false, true, false, true]
One way to prove the difference the answers are different for the same function. Rute Bezerra de Meneze Gondim
No comments:
Post a Comment