You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I used the same implementation for both addElementToBeginningOfArray and destructivelyAddElementToBeginningOfArray functions and I passed the tests (in other words, the test didn't catch that I was modifying the array with unshift operation).
Original implementation that passed arrays-test.js:
function addElementToBeginningOfArray(array, element) {
array.unshift(element);
return array;
}
function destructivelyAddElementToBeginningOfArray(array, element) {
array.unshift(element);
return array;
}
Notice it's the same implementation, but here is the to-do from the README.md file
TODO: In arrays.js, define two functions, addElementToBeginningOfArray and destructivelyAddElementToBeginningOfArray. Both functions take two parameters, an array and an element to add to the beginning of the array, and both functions should add the element to the beginning of the array and then return the whole array. The destructive function, destructivelyAddElementToBeginningOfArray, should alter the original array that's passed in; addElementToBeginningOfArray, on the other hand, should return a new array and not modify the original.
The text was updated successfully, but these errors were encountered:
I used the same implementation for both addElementToBeginningOfArray and destructivelyAddElementToBeginningOfArray functions and I passed the tests (in other words, the test didn't catch that I was modifying the array with unshift operation).
Original implementation that passed arrays-test.js:
function addElementToBeginningOfArray(array, element) {
array.unshift(element);
return array;
}
function destructivelyAddElementToBeginningOfArray(array, element) {
array.unshift(element);
return array;
}
Notice it's the same implementation, but here is the to-do from the README.md file
TODO: In arrays.js, define two functions, addElementToBeginningOfArray and destructivelyAddElementToBeginningOfArray. Both functions take two parameters, an array and an element to add to the beginning of the array, and both functions should add the element to the beginning of the array and then return the whole array. The destructive function, destructivelyAddElementToBeginningOfArray, should alter the original array that's passed in; addElementToBeginningOfArray, on the other hand, should return a new array and not modify the original.
The text was updated successfully, but these errors were encountered: