for (var i = 0; i < result2.users.all_name.length; i++) {
res += '<option value="' + result2.users.all_name[i] + ' | ' + result2.users.short_name[i] + '">' + result2.users.all_name[i] + ' | ' + result2.users.short_name[i] + '</option>';
}
if (result2.users.short_name[i] != ''){вывести или не вывести код уже внутри цикла}
for (var i = 0; i < result2.users.all_name.length; i++) {
const something = result2.users.short_name[i] != '' ? 'SHORT NAME NOT EMPTY' : 'SHORT NAME EMPTY'
res += '<option value="' +
result2.users.all_name[i] + ' | ' +
result2.users.short_name[i] + '">' +
result2.users.all_name[i] + ' | ' +
result2.users.short_name[i] +
something +
'</option>';
}