Just wondering how this function works without return keyword

Tell us what’s happening:
can anyone tell me how JSON.stringify method display the array without any returned value from the function nextInLIne().
There is no keyword “return” inside the function for array;

Your code so far

function nextInLine(arr, item) {
var testArr = [1,2,3,4,5];

console.log("Before: " + JSON.stringify(testArr));
var num = nextInLine(testArr,6);
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/79.0.3945.130 Safari/537.36.

Challenge: Stand in Line

Link to the challenge:

arr.shift() mutates the array in-place, so the array is changed. The nextInLine function does however return undefined, so the value of num will be wrong.

push and unshift change the array on which they are used
testArr is passed in as argument of the function that use those methods, as such it is changed

num that stores the returned value is undefined because as you say it doesn’t have a return statement