Nested jQuery.each() - continue/break

后端 未结 11 511
天涯浪人
天涯浪人 2020-12-05 03:52

Consider the following code:

    var sentences = [
        \'Lorem ipsum dolor sit amet, consectetur adipiscing elit.\',
        \'Vivamus aliquet nisl quis          


        
11条回答
  •  鱼传尺愫
    2020-12-05 04:27

    Labeled Break

    outerloop:
    $(sentences).each(function() 
    {
        $(words).each(function(i) 
        {
            break; /* breaks inner loop */
        } 
        $(words).each(function(i)  
        {
            break outerloop; /* breaks outer loop */
        }
    }
    

提交回复
热议问题