stack implementation in javascript