Fetch the repository succeeded.
This action will force synchronization from 万少/前端77, which will overwrite any changes that you have made since you forked the repository, and can not be recovered!!!
Synchronous operation will process in the background and will refresh the page when finishing processing. Please be patient.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta
name="viewport"
content="width=device-width, initial-scale=1.0,maximum-scale=1,minimum-scale=1,user-scalable=no"
/>
<title>06-函数参数的默认值.html</title>
<style>
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
</style>
</head>
<body>
<script>
// (msg="大家好") "大家好" 就是msg 默认值
// 如果 调用函数的时候 你没有传递 就使用默认值
// 如果 传递了参数 就会使用传递的参数 而不会使用 默认值
// const func1 = (msg = '大家好') => {
// console.log(msg);
// };
// func1("你好"); // 输出什么 undefined
// 定义一个函数 接收一个数组 告诉我们 这个数组的长度
const getLength = (arr = []) => console.log(arr.length);
const list=['a'];
getLength(list);
getLength();
</script>
</body>
</html>
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。