FreeCodeCampChina / freecodecamp.cn

FCC China open source codebase and curriculum. Learn to code and help nonprofits.
https://fcc.asia/
Other
36.73k stars 1.36k forks source link

这样为什么会显示错误 #655

Open rh97-max opened 4 years ago

rh97-max commented 4 years ago

Challenge Stand in Line has an issue. User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/78.0.3904.108 Safari/537.36. Please describe how to reproduce this issue, and include links to screenshots if possible.

My code:

function queue(arr, item) {
  arr=arr.push(); // 请把你的代码写在这里
  var i=arr.shift();
  return i;  // 请修改这一行
}

// 初始化测试数据
var testArr = [1,2,3,4,5];

// 控制台输出
console.log("Before: " + JSON.stringify(testArr));
console.log(queue(testArr, 6)); // 你可以修改这一行来测试你的代码
console.log("After: " + JSON.stringify(testArr));