Avatar ·

What does javascript:void(0) mean and why use it in links?

Hi! I just started learning JavaScript and often see this construct in other developers' code:\n\n```html\nClick me\n```\n\nI understand that `href="#"` is also often used, but the page jumps to the top. And here it's strange — nothing changes in the address bar, and the page doesn't reload. But I don't fully understand what exactly `javascript:void(0)` does.\n\nWhy can't I just write `href=""`? Or remove href altogether? I tried removing it — then the link stops looking like a link (no underline, cursor doesn't change). And if I write `href="#"`, the page jumps to the top on click, which annoys users.\n\nI also saw that `void` is an operator in JavaScript. But what exactly does it do? Online sources say