如何确定参数是否发送到JavaScript函数?
要确定是否将参数发送给函数,请使用“默认”参数。
示例
您可以尝试运行以下命令来实现它
<!DOCTYPE html>
<html>
<body>
<script>
function display(arg1 = 'Tutorials', arg2 = 'Learning') {
document.write(arg1 + ' ' +arg2+"<br>");
}
display('Tutorials', 'Learning');
display('Tutorials');
display();
</script>
</body>
</html>热门推荐
10 领证幽默祝福语简短
11 小红书平安祝福语简短
12 考试祝福语日文简短版
13 给干爸过年祝福语简短
14 生日牌祝福语英语简短
15 大雪生日祝福语大全简短
16 年末祝福语简短的文案
17 师姐毕业送花祝福语简短
18 职场离职文案祝福语简短