4 ms·
Empty jQuery sets are truthy. The page gets this doubly wrong when it says an empty list is returned (instead of the 'Array-like' jQuery set.) Check the length
by knuckle_cake 17y ago
Empty jQuery sets are truthy. The page gets this doubly wrong when it says an empty list is returned (instead of the 'Array-like' jQuery set.)
Check the length property of a returned jQuery set if truthiness really matters.
- aristus 17y agoAh! I will verify and correct. Thanks.
- nfriedly 17y agoJavaScript is weird about truthyness / falsyness of arrays: if([] == false){ // this code runs } if( [] ) { // this code also runs } if([] == true){ // this code doesn't run } From http://nfriedly.com/techblog/2009/06/advanced-javascript-operators-and-truthy-falsy/ http://nfriedly.com/techblog/2009/06/advanced-javascript-ope...