<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>
<script>
// 1.
// function fu(){
// return 20
// }
// let re = fu()
// console.log(re)
// 2.
function getTotalPrice(x , y){
return x + y
console.log(111)
// return后面的代码不会执行,return不要换行,否则undefined
}
let sum = getTotalPrice(1, 2)
console.log(sum)
console.log(sum)
// 3.
function fn(){
}
let re =fu()
console.log(re) //undefined
</script>
</body>
</html>
05_函数的返回值
最新推荐文章于 2024-07-20 10:36:53 发布