Another update from ingydotnet^djgoku
This commit is contained in:
parent
91df62d461
commit
948b86eafa
7604 changed files with 108452 additions and 22726 deletions
|
|
@ -0,0 +1,18 @@
|
|||
var e = '3 4 2 * 1 5 - 2 3 ^ ^ / +'
|
||||
var s=[], e=e.split(' ')
|
||||
for (var i in e) {
|
||||
var t=e[i], n=+t
|
||||
if (n == t)
|
||||
s.push(n)
|
||||
else {
|
||||
var o2=s.pop(), o1=s.pop()
|
||||
switch (t) {
|
||||
case '+': s.push(o1+o2); break;
|
||||
case '-': s.push(o1-o2); break;
|
||||
case '*': s.push(o1*o2); break;
|
||||
case '/': s.push(o1/o2); break;
|
||||
case '^': s.push(Math.pow(o1,o2)); break;
|
||||
}
|
||||
}
|
||||
document.write(t, ': ', s, '<br>')
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue