There is some errors :
your first condition should be separated by
and
(&&
) operators instead ofor
since you are using negative conditionsince you convert string to numbers don't forget to convert the characters into integers (with something like
+postArr[i]
)you should push the result and not a string with a comment (
stack.push(result)
and notstack.push("result = " + result)
).
See this jsfiddle : http://jsfiddle.net/scaillerie/GwDTM/2/.