0
Pls what could void keyword be mainly use for in JavaScript
Void keyword
2 Answers
+ 6
Thanks to Google! This might help you đ
https://www.quackit.com/javascript/tutorial/javascript_void_0.cfm
What Does JavaScript Void(0) Mean? - Quackit Tutorials
+ 1
The void operator evaluates the given expression and then returns undefined. If you have pass 0 as the unary expression operand to the void operator, JavaScript coerces 0 to "false" and returns, but void doesn't care and simply returns undefined, which means "do nothing" . Put them together and you have composed a way to programmatically "do nothing" when a link is clicked. JavaScript Void(0) is often used when, inserting an expression into a web page may produce an unwanted side-effect.
More examples on JavaScript void(0):
http://net-informations.com/js/iq/void.htm