Possible Duplicate:
what is the point of void in javascript
What is purpose of using void here ? if just remove void(), it should also work, right?
var b=document.body;
if(b&&!document.xmlVersion) {
void(z=document.createElement('script'));
void(z.src='http://www.google.ca/reader/ui/subscribe-bookmarklet.js');
void(b.appendChild(z));
}
else {
location='http://www.google.com/reader/view/feed/'+encodeURIComponent(location.href);
}
I googled your code snippet and it looks like its typically embedded in a link with “javascript:” in front of it. To quote the Mozilla reference for the void operator:
source: https://developer.mozilla.org/en/JavaScript/Reference/Operators/Special/void
So it keeps the contents of the page from being overwritten when the code is executed inside of a link.
In this case, if the code is executed without the javascript: URI, the void operator should not make any difference. The void operator simply evaluates its input expression and returns undefined.