Use operator void to return undefined in JavaScript Technology
Maybe yes posted on 2014-12-30 18:45
Original link: http://blog.lmlphp.com/archives/53 from: lmlphp backyard
When you return undefined in a JavaScript function and execute an expression, you can use the Void keyword. The most familiar use of void is generally in the href attribute of the link, you can block the default behavior of the <a> tag. Take a look at the following code snippet:
<script>function (t) {return o?t (): void I.push (t)}</script>
Using void in JavaScript to manipulate the return value of any one expression is undefined. There are other ways to get undefined in a function, see the following example, a snippet from the LMLJS framework:
<script> (function (Win, doc, undf) {}) (window, document);</script>
In the anonymous function above, one is defined when defining the parameter, and the default value of the parameter not passed is undefined. about how to get undefined in JavaScript? Direct use of undefined is not rigorous, because "undefined" is not a reserved word in JavaScript and can be assigned a value. Many editors highlight undefined when highlighting JavaScript code, which makes it easy for programmers to misunderstand. Therefore, the best way to return the undefined type value in JS is to use void 0.
Read (25) reviews (0) View comments
"Reprint" returns undefined using operator void in JavaScript