GoConqr has a new look! Let us know what you think.

Module 9 of 10 · Media

Pick a random food for today!

Kostas Diakogiannis

Pick a random food for today!

M-5 Pick a random food to eat

Are you hungry but you don't know what to eat for today?

Create an array with 7 different favorite foods of yours.

ex. favFoods = ['bananas', 'rice', 'chocolate', 'pizza', 'mett', 'bread', 'onions'];

Create a function that picks randomly one of this seven foods and prints it to the console.

Bonus: Create a function that actually selects randomly one of these for every day of the week and  prints:

'On Monday i will have bananas'

'On Tuesday i will have pizza'

'On Wednesday i will have onions'

etc.

hint: You may want to create another array to hold there, the days of the week. Also when a food is selected it cannot be reselected, that means you need to remove it from the array. Maybe the splice method that any array provides will help in this case. (Check the array methods inside the array section).

arr.splice(which index to start removing, how many elements)

Instructions

You must submit an attempt for this quiz to progress. You can submit it after the last question.

Go to the chosen module

Feedback

What is it about?

What do you think of the new look?

How do you like it?