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>  
                
来都来了,留个言吧🙂