简体   繁体   English

“_”在这里意味着什么?

[英]What does “_” means here?

I am learning backbone.js, in it's tutorial , it has the following code 我正在学习backbone.js,在它的教程中 ,它有以下代码

var object = {};
_.extend(object, Backbone.Events);
...

I don't understand the " _ " in the code, what does it means? 我不明白代码中的“ _ ”,这意味着什么? and what is this "extend"? 什么是“延伸”? does it has the same meaning as jQuery.extend ? 它与jQuery.extend具有相同的含义吗?

From Backbone's own homepage : 来自Backbone自己的主页:

Backbone's only hard dependency is Underscore.js. Backbone唯一的硬依赖是Underscore.js。

_ is the object created by Underscore.js, in the same way as $ is the jQuery object _是Underscore.js创建的对象,与$是jQuery对象的方式相同

http://documentcloud.github.com/underscore/#extend as for what _.extend does. http://documentcloud.github.com/underscore/#extend关于_.extend作用。

It copies all the Backbone.Events properties over to the object. 它将所有Backbone.Events属性复制到对象。 Extend is a method from the underscore library: http://documentcloud.github.com/underscore/#extend Extend是下划线库中的一种方法: http//documentcloud.github.com/underscore/#extend

I'd say it's the same as the jQuery method. 我会说它和jQuery方法一样。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM