Basic JavaScript - Returning Boolean Values from Functions

Tell us what’s happening:
Describe your issue in detail here.
why am i not getting it
Your code so far

function isLess(a, b) {
  // Only change code below this line
  // if (a < b) {
  //   return true;
  // } else {
  //   return false;
  // }
  function isLess(a,b) {
return a < b;
}
  // Only change code above this line
}
  
isLess(10, 15);

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:109.0) Gecko/20100101 Firefox/117.0

Challenge: Basic JavaScript - Returning Boolean Values from Functions

Link to the challenge:

It looks like you copied an answer you found directly into the function. I don’t recommend that.

You shouldn’t have a function definition inside of the function definition on this Challenge.

Tell us what’s happening:
Describe your issue in detail here.
not any different here
Your code so far

function isLess(a, b) {
  // Only change code below this line
  if (a < b) {
    return true;
  } else {
    return false;
  }
  function isLess(a, b) {
    return a === b;
  }
  // Only change code above this line
}
  
isLess(10, 15);

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:109.0) Gecko/20100101 Firefox/117.0

Challenge: Basic JavaScript - Returning Boolean Values from Functions

Link to the challenge:

Can you explain why you have this function definition inside of your function definition?

You basically had it in the opening post, you just needed to get rid of the extra function declaration you added. You can’t declare function isLess(a,b) { twice.

Try deleting the if/else code instead of commenting it out, then maybe it will be more clear.

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