如何确定参数是否发送到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 恩师退休花束祝福语简短