Skip to content

Instantly share code, notes, and snippets.

@peaceintheheart
Created December 30, 2020 21:06
Show Gist options
  • Save peaceintheheart/ac403d2b566f0463756ef98eaf3bf336 to your computer and use it in GitHub Desktop.
Save peaceintheheart/ac403d2b566f0463756ef98eaf3bf336 to your computer and use it in GitHub Desktop.
/*
Assume that `colors` in the function below will look something like the following:
[ 'Red', 'Yellow', 'White' ];
*/
// Require `addColorToPlant` here.
let addColorToPlant=require("./plants.js");
function generateRosesByColor(colors) {
let result = [];
for (let i = 0; i < colors.length; i++) {
let color = colors[i];
let rose = addColorToPlant({ name: "Rose" }, color);
result.push(rose);
}
return result;
}
// Export `generateRosesByColor` as a function (not an objct).
module.exports = generateRosesByColor;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment