Basic JavaScript - Returning Boolean Values from Functions

Tell us what’s happening:

Describe your issue in detail here.

Your code so far

In the course I learnt that if code returns true the code is executed but if it returns false the code is not executed hence if the return of a strict equality is false wont the whole code not be executed hence how do we get the false value

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

isLess(10, 15);

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/ Safari/537.36 Edg/

Challenge Information:

Basic JavaScript - Returning Boolean Values from Functions

You should not use an if-else statement in this case.

1 Like

You are somewhat correct, it applies to the condition, if(a<b) this is a condition which checks true or false

“The return statement spits out whatever you tell it to. If a strict equality check gives you true , the function says, ‘Alright, I’ll return true ,’ and if it’s false , it goes, ‘Cool, I’ll return false .’ No need to complicate it with extra if statements; it’s straightforward!”