Deleting records based on a null value

I am trying to create a method that loops through a set of records and whenever a certain field contains a null or empty value, deletes the entire record. What is the proper syntax to achieve this?

something like this:

for(var i=1;i<=controller.getMaxRecordIndex();i++)
{
controller.recordIndex = i;
if(!dataprovider)
{
controller.deleteRecord();
}
}