-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathmain.js
32 lines (27 loc) · 1 KB
/
main.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
function getRecipe(recipeName){
// insert your code here
// return the recipe object with the instructions and ingredients
}
function getIngredients(recipeName){
return new Promise((resolve, reject) => {
setTimeout(() => {
if(recipeName === "Spaghetti Carbonara"){
resolve(["Spaghetti", "Eggs", "Pancetta", "Parmesan Cheese", "Black Pepper"]);
} else{
reject("recipe not found")
}
},1000)
})
}
function getInstructions(recipeName){
return new Promise((resolve, reject) => {
setTimeout(() => {
if(recipeName === "Spaghetti Carbonara"){
resolve(["Cook spaghetti al dente.", "Fry pancetta until crispy.", "Whisk eggs with Parmesan cheese and black pepper.", "Add cooked spaghetti to pancetta and toss with egg mixture.", "Serve immediately."]);
} else {
reject("recipe not found")
}
},1000)
})
}
// EXECUTE / TEST your getRecipe funcion