Kiểm tra hàm đã định nghĩa bằng toán tử typeof so với 'undefined'.
Ví dụ
<!DOCTYPE html>
<html>
<body>
<script>
function display() {
alert("Demo Text!");
}
if (typeof display === 'undefined') {
document.write('undefined');
} else {
document.write("Function is defined");
}
</script>
</body>
</html>