Clear, practical technology insights BSOD Code Lookup · Windows Error Code Lookup · Wi-Fi Troubleshooting · PC Troubleshooting Checklist

Void Keywords in JavaScript

Explore Void Keywords in JavaScript with clear explanations, practical examples, and useful tips.

Table of Contents

This guide covers void keywords in JavaScript with practical context and easy-to-follow details. Use it to understand the subject and apply the information confidently.

Syntax

The syntax of Void Can be one of two types:

 type = "text/javascript" > 

Example 1

The most common use of this operator is in a Client-Side JavaScript : URL, which allows you to estimate an expression for its secondary effects (side-effects) that the browser does not display value. Of the estimated expression.

Here the Alert ('Warning! !! ') Expression is evaluated but it is not loaded back in the current document.

 type = "text/javascript" > 
 Click the following, This won't react at all.  href = "javascript:void(alert('Warning!!!'))" > Click me! 

Result

Follow the above method to see the results

Example 2

See the following example. The following link will be nothing because the expression "0" has no effect in JavaScript. Here the expression "0" is estimated, but it is not loaded back in the current document.

 type = "text/javascript" > 
 Click the following, This won't react at all.  href = "javascript:void(0))" > Click me! 

Result

Follow the above method to see the results

Example 3

Another use of Void Is primarily to create Undefined Values as follows:

 type = "text/javascript" > 
 Click the following to see the result:  type = "button" value = "Click Me" onclick = " getValue (); " /> 

Result

Follow the above method to see the results

According to Tutorialspoint

Previous article: Dialogs - Alert, Prompt, Confirmation in JavaScript

Next lesson: Print the page in JavaScript

FAQ

What should I check before following these steps?

Confirm device and software compatibility, save important data, and make sure you have the required permissions, files, and account access.

Why might the process not work?

Common causes include outdated software, missing permissions, incompatible hardware, an unstable connection, or completing a step in the wrong order.

Can I undo the changes if necessary?

That depends on the tool or setting. Use built-in restore options when available, keep a backup, and record the original configuration first.

Discussion

Reader Comments 0

Sign in with email or Google to join the discussion.