Advertisement
Guest User

Untitled

a guest
Feb 18th, 2020
127
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
HTML 0.74 KB | None | 0 0
  1. <!DOCTYPE html>
  2. <html>
  3.     <head>
  4.         <meta charset="utf-8">
  5.     </head>
  6.     <body>
  7.         <script>
  8.             //stek stavam elementi eden vrz drug, ima  funkcii :s.peek(dava element na vrvo); s.pop(vade element od vrvo); s.push(stava element na vrvo);
  9.             stack s;
  10.             niza = [1, 4, 8, '+', 3, '*', '-', 0];
  11.             for (i=0; niza[i]!=0; i++){
  12.                 if(proveri(niza[i])==true){
  13.                     s.push(niza[i]);
  14.                 }
  15.                 else if( tab[i]=='*'){
  16.                  var prva = s.pop;
  17.                  var vtora = s.pop;
  18.                  s.push(prva*vtora);
  19.  
  20.                 }
  21.              }
  22.              console.log(s.peek);          
  23.         </script>
  24.     </body>
  25. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement