codecamp

JavaScript 队列

function queue(arr, item) {
// Your code here
item =arr.push(item);
  item=arr.shift();
return item;// Change this line
}
// Test Setup
var testArr = [1,2,3,4,5];
// Display Code
console.log("Before: " + JSON.stringify(testArr));
console.log(queue(testArr, 6)); // Modify this line to test
console.log("After: " + JSON.stringify(testArr));
JavaScript 函数使用返回值进行赋值
JavaScript 布尔boolean数据类型
温馨提示
下载编程狮App,免费阅读超1000+编程语言教程
取消
确定