Python Anaconda2 Install OpenCV2’s vast water

2022-12-20   ES  

When learning Underscore.js, I found that the following code often appears in the source code:

if (context === void 0) return func;

if (array == null) return void 0;

I haven’t seen this writing before. I went online to search for some information. I just found that some people asked similar questions on Stackoverflow. Summary here, take a note. Void is actually a function in JavaScript. Accepting a parameter, the return value is always UNDEFINED. It can be said that the purpose of using VOID is to get undefined in JavaScript. Sovoid 0 is a correct and standard way to produce undefined.

void 0
void (0)
void "hello"
void (new Date())
//all will return undefined

Why don’t you use Undefined directly? There are two main reasons:

1. Use VOID 0 to reduce 3 bytes than using UNDEFINED. Although this is an advantage, personal meaning does not mean much, sacrificing readability and simplicity.

>"undefined".length
9
>"void 0".length
6

2、undefinedis not a reserved word in JavaScript, we can use itUNDEFINED as a variable name and assign it to it.

alert(undefined); //alerts "undefined"
var undefined = "new value";
alert(undefined) //alerts "new value"

Because of this, you cannot safely rely on undefined having the value that you expect。

void, on the other hand, cannot be overidden. void 0 will always return。

I tested under IE10, Firefox and Chrome. Unfortunately, there were no expected results. Although the above code has not been reported, it has not been printed “New Value” we expect.

So in general, the writing of VOID 0 is not significant.

Reference

http://stackoverflow.com/questions/7452341/what-does-void-0-mean

http://stackoverflow.com/questions/11409412/how-to-understand-return-obj-void-0-in-the-source-of-underscore

source

Related Posts

R language DPLYR package: high -efficiency data processing function (Filter, Groupby, Mutate, Summarise)

1 1 1 1 1 1

CSUOJ: Training Team Team Plan

APP Store to add new applications

Python Anaconda2 Install OpenCV2’s vast water

Random Posts

IOS-dynamic library and static library

Record JMETER5.0 Starting the problem of flashing and retreating

How to download with JS for file download

Ruby On Rails Oracle Configure Oracleenhanced, Ruby-OCI8 installation, ORA-12154: TNS

A solution to AndroidStudio introduced a problem with the problem that the Module occurred.