Reputation: 1180
define([
'jquery',
'underscore',
'backbone',
'models/Evaluate'
], function ($, _, Backbone, Evaluate) {
var MyCollection = Backbone.Collection.extend({
model:Evaluate,
url:'evaluate/process'
});
return MyCollection;
});
or there are also cases, when _ is returned from a function
return _;
Upvotes: 1
Views: 77
Reputation: 13003
JavaScript allows you to name your variables/functions with various characaters, such as: $
, _
So given that, this probably another variable name.
Upvotes: 0
Reputation: 47966
This is the name of the variable that holds the underscore plugin.
In a similar manner, the $
character is used for jQuery.
Both of these can be changed, but these are the defaults that each library sets up.
In your example, you are using requireJS to load dependencies, these will be passed in the same order that they are listed. jQuery first and then underscore, this is why the function is passed:
function ($, _, ...)
// ---^ underscoreJS
// ^ jQuery
Hands on example:
Calling the uniq
underscore function:
_.uniq([1, 2, 1, 3, 1, 4]);
Calling the each
jQuery function:
$.each([ 52, 97 ], function(...) );
Upvotes: 0
Reputation: 10148
_
is the name of a variable. The same as $
is a variable commonly used as an alias for jQuery
variable.
Upvotes: 0
Reputation: 6181
_
is a variable name. In this case, it is referring to the JavaScript library Underscore.
Upvotes: 2