Stack and Queue implementations in JavaScript