Is because void takes one argument. You want:
<a href="javascript:void(0);" onclick="myFunction();">aaa</a>
Use
<a href="javascript:void(0);" onclick="myFunction();">aaa</a>
void expects a parameter.
There's an interesting discussion on using void(0) or other techniques here.
void is an operator, not a function. It requires a single expression as its operand. () is not a valid expression. The correct syntax is:
<a href="javascript:void 0;" onclick="myFunction();">aaa</a>
You can put parentheses around 0, but they're not necessary, just as you don't need parentheses around 0 when writing 3 + 0.