Aug 9, 2022
Null is the billion dollar mistake and also a code smell.
function carBrandExplicit(model) {
if (model === 'A4') {
return 'audi';
}
if (model === 'AMG') {
return 'Mercedes-Benz';
}
// Fail Fast
throw new Exception('Model not found);
}
this function either returns the first two values or throws an excepcion.
No nulls are involved