I dont know what the task is

I dont know what the task is
0

#1

Tell us what’s happening:

What in the world does freecodecamp want from me? Can anyone tell me what I have to do to fulfill this task?

Your code so far

function nextInLine(arr, item) {
  // Your code here
  
  return item;  // Change this line
}

// Test Setup
var testArr = [1,2,3,4,5];

// Display Code
console.log("Before: " + JSON.stringify(testArr));
console.log(nextInLine(testArr, 6)); // Modify this line to test
console.log("After: " + JSON.stringify(testArr));

Your browser information:

Your Browser User Agent is: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:55.0) Gecko/20100101 Firefox/55.0.

Link to the challenge:


#2

in the code you posted, i think it wants you to add 6 into the array
so
[1, 2, 3, 4, 5]
will become
[1, 2, 3, 4, 5, 6]

and then remove the first item from the array. so test arr will become
[2, 3, 4, 5, 6]

and returning the function with the one being removed…
which is 1

2 functions that might help you accomplished this task would be
Array push
and
Array shift

hope this helps


#3

Thank you very much, you helped me a lot ! I have one more question tho. What are the console.log paragraphs above the main code:

console.log("Before: " + JSON.stringify(testArr));
console.log(nextInLine(testArr, 6)); // Modify this line to test
console.log("After: " + JSON.stringify(testArr));


#4

console.log are used to print out the value of var to the console.
it is useful for debugging purpose ( to see the variable value on a specific time )

most browser have a console… you can open it to see what the console.log prints

this link shows how to access the console from several browsers w3schools debugging


#5

youre the man, thank you !