
CodePudding user response:
Var input, arr=[];While (input!==1) {
Input=Number (prompt (" please enter the Number));
If (isNaN (input)) {
Alert (" please enter the legal digital ')
} else {
Arr. Unshift (input)
}
}
Var res=arr. Slice (1);
Res. Sort ((a, b)=& gt; A - b)
CodePudding user response:
Var input;
var arr=[];
While ((input=parseFloat (prompt (" please enter the number ", "")))!=1) {
Arr. Push (input);
}
Arr. Sort (function (a, b) {
Return b - a;
});
Alert (arr);
CodePudding user response:
Thank you