re: `throw` objects and functions VIEW POST

VIEW PARENT COMMENT VIEW FULL DISCUSSION
 
 

Sure, but that's still very different from your example, which could have been just this:

let value;

// try reading from cache
// if not found, fetch it from external resource
value = read(key);
if (!value) {
  value = fakeExternalRes(key);
  store(key, value);
}

return value;

I understand that examples need to be simplified, I just feel that yours got simplified to the point where it's not actually showing what you intended to anymore.

code of conduct - report abuse