$.each(data, function(i){
_(catalog.add(this));//iterating through each object in objectStore
});
I was wondering what difference does it make if i exclude the underscore before the function call.
Update
The OP is referring to the jquery indexeddb plugin.
Enforced by the Python interpreter. Double Leading and Trailing Underscore( __var__ ): Indicates special methods defined by the Python language. Avoid this naming scheme for your own attributes. Single Underscore( _ ): Sometimes used as a name for temporary or insignificant variables (“don't care”).
Leading Underscore before variable/function /method name indicates to the programmer that It is for internal use only, that can be modified whenever the class wants.
Python automatically stores the value of the last expression in the interpreter to a particular variable called "_." You can also assign these value to another variable if you want.
An underscore in front usually indicates an instance variable as opposed to a local variable. It's merely a coding style that can be omitted in favor of "speaking" variable names and small classes that don't do too many things. Follow this answer to receive notifications.
It calls a function called _
and passes the result of the expression catalog.add(this)
as the first and only argument.
That function is quite likely the one defined by the library you can download from underscorejs.org, which is another in a series of libraries that lack intention revealing variable names.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With