함수 리터럴은 이름 없는 함수를 정의하는 표현식입니다. 다음 코드를 실행하여 JavaScript에서 함수 리터럴을 구현할 수 있습니다.
예시
<html>
<head>
<script>
<!--
var func = function(x,y){ return x*y };
function secondFunction() {
var result;
result = func(10,20);
document.write ( result );
}
//-->
</script>
</head>
<body>
<p>Click the following button to call the function</p>
<form>
<input type = "button" onclick = "secondFunction()" value = "Call Function">
</form>
</body>
</html>