Hello! I’m very new to coding (just two weeks in now) so I’m very much a beginner and still learning. I’ve just gotten through the lesson on Functions and I’ve been practicing to make sure I have a good handle on it.
One of the practice questions is : "Define an order()
function that announces your ice cream order.
It should take two arguments: the number of scoops and the flavor. It should return the order in this format: "Lemme get [number] scoops of [flavor]!"
It should use “scoop” when number
is 1
and “scoops” for anything greater."
I have tested my code and it shows the right results in the console but I guess there’s a syntax error somewhere because when I try to submit the answer, it says the result is undefined. I’ve put the same code into a few syntax checkers and nothing has popped up so I’m not sure what’s wrong. Here is my code:
const order = (number,flavor) => {
if(number > 1) {
console.log(Lemme get ${number} scoops of ${flavor}!
);
} else {
console.log(Lemme get ${number} scoop of ${flavor}!
);
}
};
order(1,‘vanilla’);