Javascript 我想把两者对比一下,但我会坚持下去

Javascript 我想把两者对比一下,但我会坚持下去,javascript,jquery,javascript-framework,Javascript,Jquery,Javascript Framework,通常,核心方法对选定的jQuery对象进行操作 // Loop through selected jQuery objects, operating on each $('li').each(function(index) { alert(index + ': ' + $(this).text()); }); 实用工具方法不会直接对选定的jQuery对象进行操作;但是,相反,只需向开发人员提供某种形式的功能或实用程序。它类似于任何其他JavaScript函数。$允许它拥有jQuery已

通常,核心方法对选定的jQuery对象进行操作

// Loop through selected jQuery objects, operating on each
$('li').each(function(index) {
    alert(index + ': ' + $(this).text());
});
实用工具方法不会直接对选定的jQuery对象进行操作;但是,相反,只需向开发人员提供某种形式的功能或实用程序。它类似于任何其他JavaScript函数。
$
允许它拥有jQuery已经熟悉的“伪名称空间”

// Loop through an array of numbers
$.each([52, 97], function(index, value) { 
    alert(index + ': ' + value); 
});

正如@cleric所指出的,这在中更详细地解释了这一点。

实际上这不是一个家庭作业问题……我知道这听起来有点理论化,但我只需要实际的例子来理解不同类型的jQuery方法。@Ben Barden:他们现在在学校教jQuery?这听起来要么是好消息,要么是坏消息。这根本不是离题。这是一个新jQuery用户提出的一个完全正确的问题,但并不清楚。我实际上认为这是一个正确的问题,即使OP没有使用最好的术语。你我都知道jQuery是如何架构的,但这并不意味着每个人都知道。投票重新开放。@josh3736:完全同意你的意见……非常感谢……回报类型的差异是什么?还有,$是什么意思,$()是什么意思?我修改了我的答案,希望能澄清一些事情。令人兴奋的解释…如果我可以,我会给这个1000票。。。
$.fn.hide = function() {
   return this.each(function() {
      $(this).css({'display':'none'});
   });
}
var myLinks = $('a.my-selector');

myLinks.click(function() { /* handle click */ });
myLinks.css({'font-weight':'bold'});
$('a.my-selector').click(function() { /* handle click */ }).css({'font-weight':'bold'});
var myArray = [];

alert($.isArray(myArray)); // displays true
$.isArray = function(o) {
 // check if o is array and return true or false
};
function isArray(o) {
   // check if o is array and return true or false
}
// Loop through selected jQuery objects, operating on each
$('li').each(function(index) {
    alert(index + ': ' + $(this).text());
});
// Loop through an array of numbers
$.each([52, 97], function(index, value) { 
    alert(index + ': ' + value); 
});