Tell us what’s happening:
Dear All,
Good afternoons,
I would like ask you in which cases can we use the vertical bars, or specifically why we used it in this challenge? i saw some solutions posted in the forum that´s why i used it but sadly i don´t understand what ´s the reason of its usage. I send you all a picture of my code and i thank you in advance any orientation provided.
Have you all a wonderful day,
Kind regards,
Ivonne
Your code so far
function nextInLine(arr, item) {
// Your code here
testArr.push(item);
testArr.shift(arr[0]);
return arr[0] || 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, 1)); // Modify this line to test
console.log("After: " + JSON.stringify(testArr));
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/76.0.3809.132 Safari/537.36
.
Link to the challenge: