जावास्क्रिप्ट Try……Catch स्टेटमेंट :
try……catch के द्वारा हमें जावास्क्रिप्ट के कोड के ब्लाक में अगर कोई त्रुटि है।
- जावास्क्रिप्ट For……..in स्टेटमेंट का प्रयोग कैसे करें।
Example :
<html>
<head>
<script type=”text/javascript”>
var txt=””;
function message()
{try
{
addlert (“welcome guest!”);
}
{
catch (err)
{
txt=”There was an error on this page.nn”;
txt+=”Error description:” + err. description +”nn”; txt+=”click ok to continue.nn”; alert(txt);
}
}
</script>
</head>
</html>