जांचने के लिए कि जावास्क्रिप्ट फंक्शन डिफाइंड है या नहीं, इसे "undefined" के साथ चेक करें।
उदाहरण
जावास्क्रिप्ट में फंक्शन डिफाइंड है या नहीं, यह जांचने के लिए निम्नलिखित उदाहरण चलाएं:
<!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>