js函数累加
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title></title>
</head>
<!--累加1-100-->
<script type="text/javascript">
function getsum(num1,num2){//定义两个形参
var num=0;
for (var i=num1;i<=num2;i++) {
num+=i;//每次累加
}
console.log(num)//输出结果
}
getsum(1,100)//传实参
</script>
<body>
</body>
</html>
js函数累加
原文:https://www.cnblogs.com/qq1561942060/p/15268085.html