I'm pretty new to coding and am running into a roadblock. I'm working on a challenge that I just can't seem to figure out.
function createArray() {
var array = [];
array.push = function(val){
array[array.length] = val;
return array;
};
array.pop = function(){
return array[array.length - 1];
};
return array;
};
var myArray = createArray();
When I run the test to complete the challenge, this code seems to push and pop a single value, but it doesn't seem to push and pop multiple values(which is one of the parameters for completing the challenge). Does anyone have any ideas? Possible solution? Any help would be amazing.