From the course: Learning Functional Programming with JavaScript ES6+
Unlock the full course today
Join today to access over 22,600 courses taught by industry experts or purchase this course individually.
Slicing - JavaScript Tutorial
From the course: Learning Functional Programming with JavaScript ES6+
Slicing
- [Narrator] The next built in array method we're going to be looking at is called slice. Unlike the last few built in methods we've seen, slice is not a higher order function. It doesn't take a function as an argument, like map or filter, but it does have some important uses when working with arrays in JavaScript. I mentioned earlier in the course that their are some array functions that mutant the arrays you call them on. Sort, which we'll look at in a later video, is one of those functions. And we also have push and pop which add and remove elements from the array respectively, but also mutate the array. So as I mentioned, these functions don't just return a copy of the original array, they actually mutate the original array. And this isn't always obvious. It's for this reason that I strongly recommend that you use ESLint, which I showed you how to set up in a previous video, to catch unintended mutations for you. So what does this mean for us? JavaScipt provides these very useful…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.
Contents
-
-
-
-
-
(Locked)
JavaScript: Functional parts1m 53s
-
(Locked)
The spread operator5m 30s
-
Mapping5m 11s
-
(Locked)
Filtering6m 59s
-
(Locked)
Every/some5m 46s
-
(Locked)
Slicing3m 38s
-
(Locked)
Sorting5m 11s
-
(Locked)
Reducing6m 23s
-
(Locked)
Combining functions6m 40s
-
(Locked)
Challenge: Recreate the map function1m 3s
-
(Locked)
Solution: Recreate the map function3m 6s
-
(Locked)
-
-
-