"Find the two largest values among the 10 digits entered. p.s. Use 'prompt' to get the integer from user."
I would like to solve this question by "array", not "if", what should I do?
I have tried, but error.....
<script type="text/javascript">
var a, b, c;
var arr = new Array[3];
arr[0] = a;
arr[1] = b;
arr[2] = c;
a = window.prompt("Enter a number");
b = window.prompt("Enter a number");
c = window.prompt("Enter a number");
arr.sort(function(a,b){return a - b})
window.alert(arr[arr.length-1] + " and " + arr[arr.length-2])
</script>