We often use code such as Javascript:void (0), so what does javascript:void (0) mean in JavaScript?
The key in Javascript:void (0) is the Void keyword, which is a very important keyword in JavaScript, which specifies that an expression is evaluated but does not return a value.
The syntax format is as follows:
<href= "javascript:void (0)"> Click here Nothing will happen </a >
void (0) evaluates to 0 when the user links, but does not have any effect on Javascript.
In the following example, a warning message is displayed after the user clicks the link:
<href= "javascript:void (alert (' Warning!!! ')") > point me! </ a >
Parameter A in the following instance returns undefined:
function GetValue () { var a,b,c; void (b = 5, c = 7 ); document.write (' a = ' + A + ' B = ' + b + ' c = ' + c);}
void () simply means that no value is returned, but the expression inside the parentheses is still running, such as D:
void (Alert ("wornning!"))
JavaScript Basics (KB) void