Complete the queue Push and Pop operations. Elements in the queue are of type int

let arr1 = []
let arr2 = []

function push(node){
    arr1.push(node)
}

function pop(){
    if(! arr2.length) {while(arr1.length) {
            arr2.push(arr1.pop())
        }
    }
    return arr2.pop()
}
Copy the code

Stack inserts and deletions are allowed only at the end of the table

Queues only allow insertion of data elements at the end of the table and deletion at the head of the table