জাভাস্ক্রিপ্ট ফাংশন ডিফাইনড আছে কিনা চেক করতে, এটিকে 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>