为什么sum是未定义变量
<script type="text/javascript">
//带参数有返回值;
function add (x, y, z){
var sum = x + y + z;
return sum;
}
add(10, 20, 30,);
var s = sum;
document.write(s);
</script>
<script type="text/javascript">
//带参数有返回值;
function add (x, y, z){
var sum = x + y + z;
return sum;
}
add(10, 20, 30,);
var s = sum;
document.write(s);
</script>
2018-11-14
举报