Reverse polish notation problem in javascript #RPN | (LeetCode)