Skip to content

Instantly share code, notes, and snippets.

@Smithx10
Last active March 19, 2018 21:22
Show Gist options
  • Save Smithx10/a1073432bcf0cd573c662a60d05b9ca0 to your computer and use it in GitHub Desktop.
Save Smithx10/a1073432bcf0cd573c662a60d05b9ca0 to your computer and use it in GitHub Desktop.
error handling
5 recipes.prototype.getRecipe·=·function·getRecipe(name)·{§
6 ····if·(typeof this.recipe[name]·!==·'undefined')·{§
7 ········return·this.recipe[name];§
8 ····}§
9 ····else·{§
10 ········return·name·+·'·not_found';§
11 ····};§
12 }§
I'd like for this to still work.
recipes.prototype.createRecipe = function createRecipe(name, size) {
if(!this.getRecipe(name)) {
// do work
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment