-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathaddRecipeButton.js
46 lines (38 loc) · 1.34 KB
/
addRecipeButton.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
'use strict'
function createRecipe (name, time, origin, ingredients) {
var newRecipe = '<article>' +
'<img src=burger.jpg>' +
'<h3>' +
name +
'</h3>' +
'<li>' +
'Cook Time: ' +
time +
'</li>' +
'<li>' +
origin +
'</li>' +
'<li>' +
ingredients +
'</li>' +
'</article>';
return newRecipe;
}
var numberOfRecipes = prompt('How many recipes do you want to add?');
// while (numberOfRecipes > 0) {
// var recipeName = prompt('What is the recipe name?');
// var recipeTime = prompt('What is the total cook time?');
// var recipeOrigin = prompt('Which region is this from?');
// var recipeIngredients = prompt('Please list the ingredients.');
// var newRecipeHTML = createRecipe(recipeName, recipeTime, recipeOrigin, recipeIngredients);
// document.write(newRecipeHTML);
// numberOfRecipes--;
// }
for (numberOfRecipes; numberOfRecipes > 0; numberOfRecipes--) {
var recipeName = prompt('What is the recipe name?');
var recipeTime = prompt('What is the total cook time?');
var recipeOrigin = prompt('Which region is this from?');
var recipeIngredients = prompt('Please list the ingredients.');
var newRecipeHTML = createRecipe(recipeName, recipeTime, recipeOrigin, recipeIngredients);
document.write(newRecipeHTML);
}