What am I missing here in the code?

function(num) {
if (num > 5 && num < 10) {
return “Yes”;
return “No”;
This is my code. When I run it it returns Syntax Error 1:22. What am I missing here?

You have an error on line 1, at roughly position 22. It probably also tells you exactly what the syntax error is. (I’m guessing “unexpected token”).

This appears to be only part of your code, so that really limits how much we can help.

1 Like

Firstly, You have altered the code. This is what a function looks like:

function nameOfFunction (parameters) {
  // body of function

You’ve deleted something critical.

Secondly, return is what is used in a function to return the result. You have a return floating around outside the function

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.