Neophyte JS seeking help to complete exercise

Neophyte JS seeking help to complete exercise


I’m learning JS and I have to do the following exercise, something I wrote, though incorrect, the important thing is to try it. Now if anyone can kindly help me understand better how to complete the exercise properly, so to understand and learn. Thanks in advance

 * This function should calculate the total amount of pet food that should be
 * ordered for the upcoming week.
 * @param numAnimals the number of animals in the store
 * @param avgFood the average amount of food (in kilograms) eaten by the animals
 * 				each week
 * @return the total amount of pet food that should be ordered for the upcoming
 * 				 week, or -1 if the numAnimals or avgFood are less than 0 or non-numeric
function calculateFoodOrder(numAnimals, avgFood) {
    var numAnimals = 10;
	var avgFood = numAnimals/7;
	var total = avgFood*7;
	if (Number(numAnimals || avgFood) < 0) and (isNaN(numAnimals || avgFood)){
	return total;

 * Determines which day of the week had the most number of people visiting the
 * pet store. If more than one day of the week has the same, highest amount of
 * traffic, an array containing the days (in any order) should be returned.
 * (ex. ["Wednesday", "Thursday"]). If the input is null or an empty array, the function
 * should return null.
 * @param week an array of Weekday objects
 * @return a string containing the name of the most popular day of the week if there is only one most popular day, and an array of the strings containing the names of the most popular days if there are more than one that are most popular
function mostPopularDays(week) {
    week = [Monday,Tuesday, Wednesday, Thursday, Friday,Saturday, Sunday];
	var weekdays = "";
	for (i=0; i<week.length; i++) {
		weekdays += week[i] + "<br>";
	if (typeof week[i] === [] || week[i] === null) {
      return null;
	/*if there is only one most popular day return "dayname";
      if there are more days than one that are most popular 
        return ["dayname","dayname","dayname"]*/

 * Given three arrays of equal length containing information about a list of
 * animals - where names[i], types[i], and breeds[i] all relate to a single
 * animal - return an array of Animal objects constructed from the provided
 * info.
 * @param names the array of animal names
 * @param types the array of animal types (ex. "Dog", "Cat", "Bird")
 * @param breeds the array of animal breeds
 * @return an array of Animal objects containing the animals' information, or an
 *         empty array if the array's lengths are unequal or zero, or if any array is null.
function createAnimalObjects(names, types, breeds) {
    names = ["Lola", "Joy", "Elohim"];
	types = ["Dog", "Cat", "Bird"];
	breeds = ["Labrador", "Siamese", "Falco"];
	return {
		Animal = [["Lola", "Joy", "Elohim"], ["Dog", "Cat", "Bird"], ["Labrador", "Siamese", "Falco"]];

//  Do not change any code below here!

 * A prototype to create Weekday objects
function Weekday (name, traffic) { = name;
    this.traffic = traffic;

 * A prototype to create Item objects
function Item (name, barcode, sellingPrice, buyingPrice) { = name;
     this.barcode = barcode;
     this.sellingPrice = sellingPrice;
     this.buyingPrice = buyingPrice;

  * A prototype to create Animal objects
function Animal (name, type, breed) { = name;
     this.type = type;
     this.breed = breed;


Firstly, welcome to the forum.

While we are primarily here to help people with their Free Code Camp progress, we are open to people on other paths, too. Some of what you are asking is pretty trivial in the Free Code Camp context, so you might find that if you’re not getting the instruction and material you need in your current studies, the FCC curriculum will really help you get started. At a modest guess I’d say investing a 4-5 hours working through the curriculum here will really pay off. You can find the curriculum at

Happy coding :slight_smile: