Using length vs not using length

Using length vs not using length

Hi,

Is there any difference between:

  1. var nameValue = $('#edit-name').val();
  2.         if (nameValue) {
  3.           $('#edit-name, #edit-pass').addClass('withValue');
  4.         }

And this:

  1. var nameValue = $('#edit-name').val();
  2.         if (nameValue.length) {
  3.           $('#edit-name, #edit-pass').addClass('withValue');
  4.         }


Thanks