Get the App
SLTechnology News&Howtos  ›  Development  › 

What does javascript void (0) mean?

Shulou Source: shulou.com Published: 2022-06-01 12:02:57 10月02日 Update

Today, the editor will share with you the relevant knowledge of what javascript void (0) means. The content is detailed and the logic is clear. I believe most people still know too much about this knowledge, so share this article for your reference. I hope you can get something after reading this article. Let's take a look at it.

Meaning of _ javascript:void (0)

We often use code like _ javascript:void (0), so what does _ javascript:void (0) mean in JavaScript?

The most critical word in _ javascript:void (0) is the void keyword, and void is a very important keyword in JavaScript, which specifies that an expression is evaluated but does not return a value.

The syntax format is as follows:

Void func ()

_ javascript:void func ()

Or

Void (func ())

_ javascript:void (func ())

The following code creates a hyperlink that nothing happens when the user clicks.

Case study

Click here and nothing will happen.

When a user links, void (0) is calculated as 0, but there is no effect on Javascript.

In the following example, a warning message is displayed after the user clicks the link:

Case study

Click the following link to view the results:

Click me!

Parameter a returns undefined in the following example:

Case study

Function getValue () {

Var a,b,c

A = void (b = 5, c = 7)

[xss_clean] ('a ='+ a +'b ='+ b +'c ='+ c)

}

These are all the contents of the article "what does javascript void (0) mean?" Thank you for reading! I believe you will gain a lot after reading this article. The editor will update different knowledge for you every day. If you want to learn more knowledge, please pay attention to the industry information channel.

Tags: Example knowledge article link meaning key user code keyword content face different big important representative information parameter meaning most of it Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Docker Shulou Information Redmi vpn Huawei