Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8931911
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T09:13:07+00:00 2026-06-15T09:13:07+00:00

I see people write void(0) all the time, but I don’t understand why people

  • 0

I see people write void(0) all the time, but I don’t understand why people use parentheses. As far as I can tell, they have no purpose. void is not a function, it’s an operator. So why do people use the parens? Do they serve a purpose? Even on MDN the parens are used.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T09:13:09+00:00Added an answer on June 15, 2026 at 9:13 am

    I have to admit that I’ve used that same construct many times in the past, mainly because I’ve seen it being used on other sites. I’m no longer using this because unobtrusive JavaScript is preferred over inline JavaScript; in fact, it’s almost exclusively used inline to make sure the page doesn’t refresh.

    Having said that, as you have rightfully pointed out, it’s an operator and not a function; the reason it still works is simply because (0) and 0 are the same thing, so this is how it would be evaluated:

    void (0);
    

    Which is identical to:

    void 0;
    

    I guess the reason it’s being written as a function invocation is because people feel more comfortable with functions when used inline 🙂

    <a href="javascript:void 0">...</a> // hold on, that can't work, can it?!
    
    <a href="javascript:void(0)">...</a> // ahhh, normality restored
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I see some people write: //wordList is List<string> wordList.ForEach(delegate(string word){ Console.WriteLine(word);}); instead of: foreach(string
Most times I see people try to use linked lists, it seems to me
Sometimes I see people use http://codepad.org as a way to quickly run/test their Perl
phpMySQL use backticks ` to surround column names, and I've just see people use
I see that people often write C code such as: char *ptr = malloc(sizeof(char)*256);
I've heard that the advantage of java is that people can write code, compile
I often see people who write SQL like this: SELECT * from TableA LEFT
I have two input fields, where people can write numbers. And what I need
I'm curious as to why I see people write log4net logging code like the
When people write an article, they submit a photo to illustrate the event. But,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.