From the course: JavaScript Essential Training

Unlock the full course today

Join today to access over 23,200 courses taught by industry experts.

Solution: Array manipulation

Solution: Array manipulation - JavaScript Tutorial

From the course: JavaScript Essential Training

Solution: Array manipulation

(upbeat music) - [Instructor] For this challenge, we have a series of tasks that need to be executed in a specific sequence, so I've left the instructions open, so I can refer to it. All right, I'll scroll down to the processArray here, and we're placing our new code in between the comments. So number one, remove the last item from the array. For this, we can use the pop method. So I'll say newDeskArr.pop. This pops the last item off the array and returns it to us, so we can do something with it, but in our case, we just want to remove it, so I'll just leave it with that. Okay, number two, sort the remaining array items alphabetically. All right, so newDeskArr again. Here we can use the sort method. If we don't provide any parameters for it, it'll automatically sort the items alphabetically based on the first letter, which is what we want. All right, next, number three, move the last item of the array to the first…

Contents