What is the difference: _ (underscore) before calling the add () make function?

$.each(data, function(i){ _(catalog.add(this));//iterating through each object in objectStore }); 

I was wondering what the difference is if I exclude the underscore before calling the function.

Update

OP refers to the jquery indexeddb plugin .

+6
source share
3 answers

It calls a function named _ and passes the result of the expression catalog.add(this) as the first and only argument.

This function is most likely the one that is defined by the library, which you can download from underscorejs.org , which is another one of a number of libraries that have no intention of revealing variable names.

+5
source

http://underscorejs.org/#chaining

I'm not quite sure what he is doing for you, but here is a document.

0
source

EDIT:

Short answer: Yes, not otherwise. Remove it.

In the original js file, _ is the name of the function to register the result of the prom object. Therefore, you need to remove it in production code if you don't care what the add method returns. add should return the newly created keys.

For me, those $ , i , _ and this do not make sense.

add(this) very scary. what is this ?

-1
source

All Articles