Remove Elements from an Array Using slice Instead of splice - Functional Programming -Free Code Camp

preview_player
Показать описание
Рекомендации по теме
Комментарии
Автор

Great lesson Mr. Ian
function nonMutatingSplice(cities) {
return cities.slice(0, 3);
}
const inputCities = ["Chicago", "Delhi", "Islamabad", "London", "Berlin"];
console.log(inputCities, " <= should not change");

console.log(inputCities, " <= should not change");

zken
Автор

non mutating splice: const splice = start => length => xs => xs.slice(0, start).concat(xs.slice(start + length)). That is all you need to say.

neto