How to remove undefined item from array.

How to remove undefined item from array.

I have an array of the type,

myArray = [
                  ["string1" + variable1],
                  ["string2" + variable2]
                 ];

the variable following the string is based on value selected via form.

i.e.

var variable1 = $('input[name="var1"]').val();
var variable2 = $('input[name="var2"]').val();

How can i remove a particular array that has value undefined / .val() == ""  ,from the main array?

For example, in the form if variable2 = ""/undefined/not given any value by the user,
my Array becomes,

myArray = [
                  ["string1" + variable1]
                 ];