Created
February 23, 2021 02:49
-
-
Save commanderh/091ff030c4053104570169a0527a7940 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/*********************************************************************** | |
Write a recursive function `iceCreamShop(flavors, favorite)` that takes in an | |
array of ice cream flavors available at the ice cream shop, as well as the | |
user's favorite ice cream flavor. Recursively find out whether or not the shop | |
offers their favorite flavor. | |
Examples: | |
iceCreamShop(['vanilla', 'strawberry'], 'blue moon'); // false | |
iceCreamShop(['pistachio', 'green tea', 'chocolate', 'mint chip'], 'green tea'); // true | |
iceCreamShop(['cookies n cream', 'blue moon', 'superman', 'honey lavender', 'sea salt caramel'], 'pistachio'); // false | |
iceCreamShop(['moose tracks'], 'moose tracks'); // true | |
iceCreamShop([], 'honey lavender'); // false | |
***********************************************************************/ | |
// your code here | |
/**************DO NOT MODIFY ANYTHING UNDER THIS LINE*****************/ | |
try { | |
module.exports = iceCreamShop; | |
} catch (e) { | |
module.exports = null; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment