CodesJava

Easy learning with example program codes

how to handle exceptions in javascript?

JavaScript latest version added exception handling capabilities. It provides try, catch and finally blocks to handle the exceptions.

Syntax of try block with catch block:

try{

       //block

Read More

how to redirect a url using javascript?

We can use window.location.replace(…) or window.location.href to redirect a url using javascript.

//Behave as an HTTP redirect
window.location.replace("http://stackoverflow.com");

//Behave as clicking on a link
window.location.href = "http://stackoverflow.com";
Read More

how to read a cookie using javascript?

JavaScript can create, read, and delete cookies with the document.cookie property.

Syntax

document.cookie = "key1 = value1; key2 = value2; expires = date";

Where:
expires: is an … Read More

Sign Up/ Sign In
Ask a Question


Copyright © 2018 CodesJava DMCA.com Protection Status SiteMap Reference: Java Wiki