ในการพิจารณาว่าอาร์กิวเมนต์ถูกส่งไปยังฟังก์ชันหรือไม่ ให้ใช้พารามิเตอร์ "default"
ตัวอย่าง
คุณสามารถลองเรียกใช้สิ่งต่อไปนี้เพื่อใช้งาน
สาธิตสด
<!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>