Member-only story

What is “void 0” in JavaScript?

Is it similar to undefined? Should we avoid it or not?

Pandhu Wibowo
JavaScript in Plain English
4 min readMay 20, 2022

Photo by Andrea De Santis on Unsplash

Hi, I’m a software engineer, and welcome to my blog. Today, we are going to discuss void 0.

What we should know about void 0

In older versions of JavaScript, you wouldn’t have found void 0 expressions. The keyword is void which is undefined.

undefined is mutable

Photo by Valentin Lacoste on Unsplash

So why do we use void 0 as an alias for undefined?

One of JavaScript’s quirks is that it is not a reserved keyword. Instead, it is a property of the global object.

According to wtjs.com,

Undefined is nothing but a global variable name without a default value. Therefore, its primitive value is undefined. You can change the value of undefined:

Create an account to read the full story.

The author made this story available to Medium members only.
If you’re new to Medium, create a new account to read this story on us.

Or, continue in mobile web

Already have an account? Sign in

Published in JavaScript in Plain English

New JavaScript and Web Development content every day. Follow to join our 3.5M+ monthly readers.

Written by Pandhu Wibowo

Assalamu’alaikum. I’m Software Engineer | Tech Enthusiast — Support me on beneteen.com | Follow me : https://www.instagram.com/pandhu.wibowo/

No responses yet

What are your thoughts?