return返回多个值,通过对象的属性访问
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>
<style></style>
<script>
function add(a,b){
var sum;
var sub
return{
sum:a+b,
sub:a-b
}
}
var obj = add(5,2);
console.log(obj.sum);
console.log(obj.sub);
</script>
</head>
<body>
</body>
</html>