使用.each()函数进行循环时,我们可以使用return false来跳出循环。例如:
$( "div" ).each(function( index, element ) {
alert('Bye...!');
return false;
});
但是,当返回任何字符串值时它会如何工作?
var myDiv = $( "div" ).each(function( index, element ) {
return "xyz";
});