I think you want to explicitly check that the length of this is not 0, since if( [] ) resolves to true.