Stack and Queue example using Javascript