javascript verification of empty or null (is it correct?)

javascript, validation

Solution

Both `null` and `""` are "falsy".

You can write

if (!$('#nu_username').val())

Problem

I'm using javascript to do a verification if an input field is empty this way: ``` if($("#nu_username").val() == null || $("#nu_username").val() == ""){ do action... } ``` It works well, but I wonder if it's redundant to use both conditions. Do you know it?

Original source