Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions _steps/step14-new-recipes.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ So let's create our `getNextId` function in `recipesDB.js`:

```javascript
function getNextId(){
var recipeWithBiggestId = db.get('recipes').maxBy(function(recipe){
return recipe.id;
var recipeWithBiggestId = db.get('recipes').maxBy(function(recipe){
return recipe.id;
});
return recipeWithBiggestId.value().id+1;
}
Expand All @@ -36,11 +36,11 @@ What this function does is ask the database what the recipe is with the largest
Now that we have that, let's create our function to add new recipes to `recipesDB.js`:

```javascript
function addRecipe(name, content){
var newRecipe = {
id: getNextId(),
name: name,
content: content
function addRecipe(recipe){
var newRecipe = {
id: getNextId(),
name: recipe.name,
content: recipe.content
};
db.get('recipes')
.push(newRecipe)
Expand Down