这给出了正确答案:
<script type="text/javascript">
var numbers=[67,56,45,34,78,54,67,90,43,56,78,90,23,45,67,89,54,1];
var sita=0;
for(i=0;i<numbers.length;i++){
if(numbers[i]>sita){
var sita=numbers[i];
document.write(sita+" ");
}
}
</script>
这不起作用:
<script type="text/javascript">
var numbers=[67,56,45,34,78,54,67,90,43,56,78,90,23,45,67,89,54,1];
for(i=0;i<numbers.length;i++){
if(numbers[i]>sita){
var sita=numbers[i];
document.write(sita+" ");
}
}
</script>
为什么?