Created
March 6, 2019 16:15
-
-
Save jvandy83/5aeb6545fc4e0c5c0da9bf84b02a4502 to your computer and use it in GitHub Desktop.
I'm perplexed...can someone clear this up for me???
This file contains 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
// Write a function called "removeFromBackOfNew". | |
// Given an array, "removeFromBackOfNew" returns a new array containing all but the last element of the given array. | |
var arr = [1, 2, 3]; | |
function removeFromBackOfNew(arr) { | |
var newArr = arr.slice([0], [2]); | |
return newArr; | |
} | |
// When I run test it says the 'last element in the passed array must be removed.' | |
// var output = removeFromBackOfNew(arr); <--- This is | |
// console.log(output); // --> [1, 2] <------- the desired | |
// console.log(arr); // --> [1, 2, 3] <------- result. | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment