-
-
Notifications
You must be signed in to change notification settings - Fork 458
Week4 homework #929
base: scotland-class4
Are you sure you want to change the base?
Week4 homework #929
Conversation
//--------------------------------------- | ||
|
||
// 3. Declare a function "isSafeForNutAllergies" that accepts "food" as a parameter | ||
// and returns false if it found the word "sesame" in the ingredients, or true otherwise | ||
|
||
function isSafeForNutAllergies(food) { | ||
return !food.ingredients.includes("sesame seeds"); | ||
//write code here |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You need to check for the word "sesame" in the ingredients so it's a bit more than checking if the food.ingredients
array includes sesame seeds. You need to use an array function that will iterate (loop) through the ingredients and then check whether each string contains that function. I would suggest that you will need to use an array function, a function of your own that you use on each element and then a function of string to check what each one includes. From this you should be able to work out whether it's true or not that there is at least one ingredient with the word sesame in it.
console.log(greet("FINNish")); | ||
console.log(greet("russian")); | ||
console.log(greet(6)); | ||
return languages[language]; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This return outside the function can be removed as it doesn't do anything.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
that's not what I have in my file. there are no lines 32,33 and 52,53. Why are they shown here?
Your Details
Your Name: Marina
Your City: Glasgow
Your Slack Name:
Homework Details
Module:
Week: