หากต้องการเรียกใช้ฟังก์ชัน JavaScript เป็นฟังก์ชัน ให้เรียกใช้เหมือนฟังก์ชัน JavaScript ที่กำหนดเองตามปกติ
ตัวอย่าง
คุณสามารถลองเรียกใช้โค้ดต่อไปนี้เพื่อเรียกใช้ฟังก์ชัน JavaScript เป็นฟังก์ชัน −
<html>
<head>
<script>
function Display()
{
document.write ("Hello World!");
}
</script>
</head>
<body>
<p>Click the following button to call the function</p>
<form>
<input type = "button" onclick = "Display()" value = "Display">
</form>
</body>
</html>