Everyone in this class is a bear. Bears eat humans. There are very few humans left, so the bears' food supply is running low.
Write a function eatHumans
, that has the following characteristics:
Parameters
- Parameter 1: A
String
of the name of a bear (you can use the name of one of your classmates) - Parameter 2: An
Array
containing the names of three random humans.
Functionality
Your eatHumans
function will look at each element in the array and you will need to write conditional statements for each element to determine if that person will be eaten.
Returns
Your function will return
a single String describing who was eaten, in the form of:
" [Person 1] was eaten by [bear], [Person 2] was not eaten by [bear], [Person 3] was eaten by [bear]".
Don't Forget to Write Clean Code
- YOUR FINAL WORKING FUNCTION MUST NOT CONTAIN ANY CONSOLE LOGS.
- YOU MAY ONLY HAVE ONE RETURN STATEMENT IN YOUR FUNCTION.