Syntax Error in Function practice?

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’);

Hi! Welcome to the forums!

Remember to press </> before pasting code, especially with syntax issues as they can be sorted out with this type of stuff.

If I run this it runs perfectly, note however, the type of backtick needed when using the ${} variables

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');

Ah thank you! I’ll remember that when posting again. And yes, I used the backtick! Must just be some error with the program.

Is there anything else in your code?

Usually this happens when you console.log twice (console.log a function that console.logs already)

No, that’s the entirety of it and it shows up properly in the console. When I try to hit the ‘check answer’ button, however, I get a message saying that the code results in ‘undefined’ when that’s not the case.

The only reason I can think of it throwing an error is if they want you to follow the exact logic listed here if num==1 which is different than else. Let’s say number == "shoe"… with you code it would return Lemme get shoe scoop of vanilla!