Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <script>
- A=prompt("Введите массив (числа через запятую):");
- if(A!==""){
- B=A.split(",");
- if(B.length!==1){
- s=B.sort(function(a,bb){return bb-a;});
- max=s[0];
- B=A.split(",");
- for(i in B){
- i=parseInt(i);
- if(parseInt(B[i])==max){
- if(typeof B[i+1] !== "undefined"){
- alert("Следующее число: "+B[i+1]);
- }else{
- alert("Максимум стоит в конце!")
- }
- }
- }
- }else{
- alert("Массив слишком мелкий!");
- }
- }
- </script>
Advertisement
Add Comment
Please, Sign In to add comment