Also many times we come to see the use of void with html a tag in the below way:
Let’s try to understand the same thing with an example. Have a look on the below cases
- Void 0
- Void (0)
- Void “hello”
- Void (new Date())
Try to understand with below example:
Var undefined = “hello world‘;
console.log(undefined); it will return hello world
This problem is not with the ECMAScript version 5 and its further version in which undefined is set as global object as read only.
In above line of code we can see the redirection path is set to flipkart but it will not redirect to that because of event.preventDefault() set at the onclick event.