Random Meals to have during the day

Completed my First Portfolio project.

Using The mixed messages, I intend on using it to generate a random Meal Plan eg. what to have for breakfast, lunch, dinner.

I am new to coding but enjoyed this project as I could just understand it. I am finding myself having to use a lot of reference and further research to get through challenges now though, which I am trying to avoid as best as possible. My code might not be the best so I will be more than happy for some constructive criticism as i’m really eager to improve. this is My github, let me know what you think :slight_smile:

the indention of your switch:

    case 'breakfast':
        mealLayout.push('for Breakfast you should have a bowl of ' + `${mealPlan[prop][menu]}`)
        case 'lunch':
           mealLayout.push('for lunch you should have ' + `${mealPlan[prop][menu]}`)
            case 'dinner':
                  mealLayout.push('for dinner you should have ' + `${mealPlan[prop][menu]}`)

is a bit off. The cases now look nested, which is not the case (pun intended)

1 Like

Thanks, I have re-committed the code for that section. Now it looks a lot better, I think that might have also been the cause for me getting confused at certain points also

That looks a lot better indeed :slight_smile:

1 Like

I like how straight forward your idea was for this project. However, I did notice that rather than returning just a string, it returns an array of strings.

var meal = mealLayout.join('. ') + '.';

Adding the above code just before your log statement, and logging this instead of the mealLayout array will give you one string instead of an array for your output.

1 Like

Hi thank you so much for your input, I have updated the code and that does look a lot better, thanks :slight_smile:

1 Like