Hormold

Untitled

Dec 4th, 2012
93
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,b){return b-a;});
  7.         max=s[0];
  8.         for(i in B){
  9.             i=parseInt(i);
  10.             if(parseInt(B[i])==max){
  11.                 if(typeof B[i+1] !== "undefined"){
  12.                     alert("Следующее число: "+B[i+1]);
  13.                 }else{
  14.                     alert("Максимум стоит в конце!")
  15.                 }
  16.             }
  17.         }
  18.     }else{
  19.         alert("Массив слишком мелкий!");
  20.     }
  21. }
  22. </script>
Advertisement
Add Comment
Please, Sign In to add comment