Omitting the semicolon, you accidentally call the hello () function. That's why using semicolons, even if the automatic semicolon function of JS engines makes them seem like they are not needed! Try the following:
<script type = 'text/javascript'>
function a()
{
;
}
a.prototype.hello = function()
{
alert('hello');
};
(function()
{
var b = 8;
}
());
</script>
source
share