How to skip to next iteration in jQuery.each() util?

后端 未结 6 726
栀梦
栀梦 2020-12-07 07:39

I\'m trying to iterate through an array of elements. jQuery\'s documentation says:

jquery.Each() documentation

Returning non-false is the same

6条回答
  •  借酒劲吻你
    2020-12-07 07:39

    Javascript sort of has the idea of 'truthiness' and 'falsiness'. If a variable has a value then, generally 9as you will see) it has 'truthiness' - null, or no value tends to 'falsiness'. The snippets below might help:

    var temp1; 
    if ( temp1 )...  // false
    
    var temp2 = true;
    if ( temp2 )...  // true
    
    var temp3 = "";
    if ( temp3 ).... // false
    
    var temp4 = "hello world";
    if ( temp4 )...  // true
    

    Hopefully that helps?

    Also, its worth checking out these videos from Douglas Crockford

    update: thanks @cphpython for spotting the broken links - I've updated to point at working versions now

    The Javascript language

    Javascript - The Good Parts

提交回复
热议问题