<p>设置函数参数默认值。</p> <p id="demo"></p> <script> function myFunction(x, y) { y = y || 0; return x * y; } document.getElementById("demo").innerHTML = myFunction(4); </script>