Hormold

Untitled

Dec 4th, 2012
107
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <script>
  2. A=prompt("Введите массив (числа через запятую):");
  3. if(A!==""){
  4.     B=A.split(",");
  5.     if(B.length!==1){
  6.         s=B.sort(function(a,bb){return bb-a;});
  7.         max=s[0];
  8.         B=A.split(",");
  9.         for(i in B){
  10.             i=parseInt(i);
  11.             if(parseInt(B[i])==max){
  12.                 if(typeof B[i+1] !== "undefined"){
  13.                     alert("Следующее число: "+B[i+1]);
  14.                 }else{
  15.                     alert("Максимум стоит в конце!")
  16.                 }
  17.             }
  18.         }
  19.     }else{
  20.         alert("Массив слишком мелкий!");
  21.     }
  22. }
  23. </script>
Advertisement
Add Comment
Please, Sign In to add comment