Return Part of an Array Using the slice Method

Return Part of an Array Using the slice Method
0.0 0

#1

Tell us what’s happening:
I think i got it right, but i keep getting newArray is not defined.

Your code so far


function sliceArray(anim, beginSlice, endSlice) {
  // Add your code below this line
  
  newArray=anim.slice(beginSlice,endSlice);
  return newArray;

  // Add your code above this line
}
var inputAnim = ["Cat", "Dog", "Tiger", "Zebra", "Ant"];
sliceArray(inputAnim, 1, 3);

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/66.0.3359.181 Safari/537.36.

Link to the challenge:
https://learn.freecodecamp.org/javascript-algorithms-and-data-structures/functional-programming/return-part-of-an-array-using-the-slice-method


#2

You need to declare your variable newArray with var, let, or const.