Efficient stack implementation using Javascript capabilities.