Finally
finally স্টেটমেন্ট আপনাকে কোড এক্সিকিউট করার অনুমতি দেয়, try এবং catch-এর পরে, ফলাফল নির্বিশেষে। নিচের উদাহরণটি finally ব্লক থেকে রেজাল্ট দেবে যদিও catch ব্লকে এরর পাওয়া গেছে।
উদাহরণ
<html> <body> <pre> <script> function addition() { document.writeln("every one should be good at addition"); } function substraction(){ document.writeln("substraction helps you"); } try { addition() division() } catch(err) { document.writeln("be good at division : " + err); } finally { substraction() } </script> </pre> </body> </html>আউটপুট
every one should be good at addition be good at division : ReferenceError: division is not defined substraction helps you