javascript 求和,奇数


<script type="text/javascript">                         
function sum(i,n){
 var sum=0;
for(var i;i<=n;i++){
 if(i%2!=0){
     sum=sum+i;
}    
}
console.log(sum); 
}
sum(1,10);
</script>