In Computer Science a queue is an abstract Data Structure where items are kept in order. New items can be added at the back of the queue and old items are taken off from the front of the queue. Here's a example: ```js function nextInLine(arr, item) { // Your code here arr.push(item); arr = arr.shift(); return arr; // Change this line } // Test Setup var testArr = [1,2,3,4,5]; // Display Code console.log("Before: " + JSON.stringify(testArr)); console.log(nextInLine(testArr, 2)); // Modify this line to test console.log("After: " + JSON.stringify(testArr)); ```
A simple JS queue

Be the first to comment

You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.