I am struggling with this challenge can you please help me point out where I’ve gone wrong and the correct way I should proceed with this challenge.
Your code so far
/**
* A long process to prepare green tea.
* @return {string} A cup of green tea.
**/
const prepareGreenTea = () => "greenTea";
/**
* Get given number of cups of tea.
* @param {function():string} prepareTea The type of tea preparing function.
* @param {number} numOfCups Number of required cups of tea.
* @return {Array<string>} Given amount of tea cups.
**/
const getTea = (prepareTea, numOfCups) => {
const teaCups = [];
for (let cups = 1; cups <= numOfCups; cups += 1) {
const teaCup = prepareTea();
teaCups.push(teaCup);
}
return teaCups;
};
// Add your code below this line
const var tea4GreenTeamFCC = getTea(prepareGreenTea, 27);
var for tea4BlackTeamFCC = getTea(prepareBlackTea, 13); // :)
// Add your code above this line
console.log(tea4GreenTeamFCC, tea4BlackTeamFCC);
Your browser information:
User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.61 Safari/537.36.
I’m having trouble with this challenge can I have help to point out where I’m going wrong and put me in the right direction .
Here’s my code
/**
* A long process to prepare green tea.
* @return {string} A cup of green tea.
**/
var for prepareGreenTea = () => "greenTea";
/**
* Get given number of cups of tea.
* @param {function():string} prepareTea The type of tea preparing function.
* @param {number} numOfCups Number of required cups of tea.
* @return {Array<string>} Given amount of tea cups.
**/
const getTea = (prepareTea, numOfCups) => {
const teaCups = [];
for (let cups = 1; cups <= numOfCups; cups += 1) {
const teaCup = prepareTea();
teaCups.push(teaCup);
}
return teaCups;
};
// Add your code below this line
var for tea4GreenTeamFCC = getTea(prepareGreenTea, 27);
var for tea4BlackTeamFCC = getTea(prepareBlackTea, 13); // :)
// Add your code above this line
console.log(tea4GreenTeamFCC, tea4BlackTeamFCC);
Im sorry to be a pain I still don’t understand what I need to do to pass the challenge this is my code below can i please have some help.
/**
* A long process to prepare green tea.
* @return {string} A cup of green tea.
**/
var for prepareGreenTea = () => "greenTea";
/**
* Get given number of cups of tea.
* @param {function():string} prepareTea The type of tea preparing function.
* @param {number} numOfCups Number of required cups of tea.
* @return {Array<string>} Given amount of tea cups.
**/
const getTea = (prepareTea, numOfCups) => {
const teaCups = [];
for (let cups = 1; cups <= numOfCups; cups += 1) {
const teaCup = prepareTea();
teaCups.push(teaCup);
}
return teaCups;
};
// Add your code below this line
var for tea4GreenTeamFCC = getTea(prepareGreenTea, 27);?
var for tea4GreenTeamFCC = getTea(prepareGreenTea, 27);?
// Add your code above this line
console.log(tea4GreenTeamFCC, tea4BlackTeamFCC);
I’m sorry I’m really struggling with this challenge can you please help me by pointing me in the right direction and the best way to approach this challenge.
The first thing you need to do is fix your variable declarations.
Here is the original code
// Only change code below this line
const tea4GreenTeamFCC = null;
const tea4BlackTeamFCC = null;
// Only change code above this line
Here is your code
// Add your code below this line
var for tea4GreenTeamFCC = getTea(prepareGreenTea, 27);?
var for tea4GreenTeamFCC = getTea(prepareGreenTea, 27);?
// Add your code above this line
/**
* A long process to prepare green tea.
* @return {string} A cup of green tea.
**/
var for prepareGreenTea = () => "greenTea";
/**
* Get given number of cups of tea.
* @param {function():string} prepareTea The type of tea preparing function.
* @param {number} numOfCups Number of required cups of tea.
* @return {Array<string>} Given amount of tea cups.
**/
const getTea = (prepareTea, numOfCups) => {
const teaCups = [];
for (let cups = 1; cups <= numOfCups; cups += 1) {
const teaCup = prepareTea();
teaCups.push(teaCup);
}
return teaCups;
};
// Add your code below this line
var tea4GreenTeamFCC = getTea(prepareGreenTea, 27);?
var tea4GreenTeamFCC = getTea(prepareGreenTea, 13);?
var tea4GreenTeamFCC = getTea(prepareGreenTea, 27);?
// Add your code above this line
console.log(tea4GreenTeamFCC, tea4BlackTeamFCC);
I’ve edited your post for readability. When you enter a code block into a forum post, please precede it with a separate line of three backticks and follow it with a separate line of three backticks to make it easier to read.
Please use the “preformatted text” tool in the editor (</>) to add backticks around text.
You have a prepareGreenTea function and a tea4GreenTeamFCC variable. You have a prepareBlackTea function and a tea4BlackTeamFCC variable. It should be pretty obvious what variable should be assigned the result of what function.
I’d suggest you reset the code.
Assign to the variable tea4GreenTeamFCC the result of calling getTea with the prepareGreenTea callback and the correct number of cups.
Assign to the variable tea4BlackTeamFCC the result of calling getTea with the prepareBlackTea callback and the correct number of cups.
Could I please have some help how to solve this challenge as I’m finding it hard to complete and know what I’ve got to do to pass the challenge, can I please have some help to put me in the right direction.
Your code so far
// Function that returns a string representing a cup of green tea
const prepareGreenTea = () => 'greenTea';
// Function that returns a string representing a cup of black tea
const prepareBlackTea = () => 'blackTea';
/*
Given a function (representing the tea type) and number of cups needed, the
following function returns an array of strings (each representing a cup of
a specific type of tea).
*/
const getTea = (prepareTea, numOfCups) => {
const teaCups = [];
for(let cups = 1; cups <= numOfCups; cups += 1) {
const teaCup = prepareTea();
teaCups.push(teaCup);
}
return teaCups;
};
// Only change code below this line
const tea4GreenTeamFCC = getTea(prepareGreenTea, 27); //
const tea4BlackTeamFCC = getTea(prepareBlackTea, 13); //
// Only change code above this line
console.log(
tea4GreenTeamFCC,
tea4BlackTeamFCC
);
var tea4BlackTeamFCC = getTea(prepareBlackTea, 13);
var tea4GreenTeamFCC = getTea(prepareGreenTea, 27);
console.log(tea4GreenTeamFCC, tea4BlackTeamFCC);
Your browser information:
User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.61 Safari/537.36.
// Only change code below this line
...
// Only change code above this line
The code you placed between these comments is correct, but you changed code outside of these comments. Changing code outside of these comments will often break the test suite. I’d reset the code and only change the code between these comments just as you have here.