How to delete a record in ServiceNow via script

Deleting a single record

var grInc = new GlideRecord('incident');
grInc.get('02d253db87178a10e30563540cbb35dc');
 
if (grInc.next()) {
	grInc.deleteRecord();
}

Deleting multiple records

var grInc = new GlideRecord('incident');
grInc.addQuery('active', false);
 
grInc.query();
 
while (grInc.next()) {
	grInc.deleteRecord();
}