I am confused with where the information comes from in this challenge:
This is what I have so far and added a screenshot, perhaps a lesson link to guide me or what I am missing, feel like its simple or something someone can guide me to the answer; just heads up DO NOT COME from a technical background, more business and art experience. Use lamens terms or articles/videos to understand solutions too
Your code so far
function nextInLine(arr, item) {
// Only change code below this line
arr.push(item);
arr.shift();
return item;
// Only change code above this line
}
// Setup
let testArr = [1, 2, 3, 4, 5];
// Display code
console.log("Before: " + JSON.stringify(testArr));
console.log(nextInLine(testArr, 6));
console.log("After: " + JSON.stringify(testArr));
This line removes something from the array but you donāt put that removed item anywhere, so it disappears instead of being returned from your function.
Itās giving me the same thing, is there an article or video to understand this because its becoming a riddle and been on this problem for a couple of days and moved unto other parts of the chapters, this one still incomplete
as jeremy pointed out its this gives you something back, you need to make use of that in that function
if you need some reading to do on this āarray methodā then i would say this article from mdn might be useful to you, happy reading Array.prototype.shift() - JavaScript | MDN
by just looking at the answers. I think everyone is holding out giving you the answer. So that you can learn by yourself. Which is awesome. Or did you eventually get the answer ?
@flowOver Oh I know that they are with holding the answer, very very common in this industry of programming.
As for the links, @JeremyLT & @bappyasif , thank you!! I will look them over and havenāt gone over yet; just kept moving until I got to it again. Will be looking it over tonight! Thank you for the article!
Itās not that we are āholding outā so much as we are trying not to take away from you the process of figuring it out. That āfiguring it outā process is a really big part of programming.