I recently had a question about how to correctly check if an element exists with jQuery. I found the answer from here:
https://learn.jquery.com/using-jquery-core/faq
It matters, and $( "#myDiv" ).length is better because it is not running document.getElementById('myDiv') twice. If you were caching the selector, it would matter much less:
var $myDiv = $( "#myDiv" );
if ($myDiv && $myDiv.length) { ... }
However, jQuery selectors always return something that will be interpreted as "truthy", so
if ($('#myDiv')) {
is a pointless check.