The Animals are Having a Feast


๐Ÿ‘ˆ๐Ÿป Back to the lesson

The animals are having a feast!

The only rule for this feast is that the animals must bring a dish of food whose name starts and ends with the same letters as the animalโ€™s name.

For example, Chickadee is bringing chocolate cake, the Great blue heron is bringing garlic naan, and Mr. Moose is bringing mousse. However, the fox is not permitted at the feast because he wants to bring fritters.

Your job is to decide if a particular animal is permitted at the feast based on the dish they want to bring.

Careful - look at those examples above carefully.

File Specification

/**

ย * Author: Mr. Squirrel

ย * Date: Feb. 2025

ย * Description: The Animals are Having a Feast

ย **/

'use strict';

Input Specification

Input values will be placed on the command-line as arguments (we will learn to read from a file soon enough!).

The first input value is the string, animal, representing the animal in question.

The second - and last - value is the string, dish, representing the food the animal wants to bring to the party.

Output Specification

Output the boolean value true if the animal is permitted at the feast and false otherwise.

Sample Input 1

./feast.js "Leo the Lion" "Lunchables"

Output for Sample Input 1

false

Sample Input 2

./feast.js "Mr. Squirrel" "marshmallow roll"

Output for Sample Input 2

true

โฌ…๏ธ Back to the lesson