How to solve this (solved)

How to solve this (solved)
0

#1

Questions is to use Switch instead of If/else statments:
function isLess(a, b) {
** // Fix this code**
** if (a < b) {**
** return true;**
** } else {**
** return false;**
** }**
}

// Change these values to test
isLess(10, 15);

i tried this, What is wrong here:


#2

@fisnikp Here is the Free Code Camp information about JS Switch statement.


#3

i am not understanding this very well can you explain it by solving my example


#6

The switch statement can only test ONE variable for a certain value.
For example an integer for the values 1, 2 ,3, etc.
I would suggest using a boolean variable, true for less and false for equal or more.

switch(a<b){ case true: return true; break; default: return false;


#7

Here is Solution:

function isLess(a, b) {
// Fix this code
return a < b;
}
// Change these values to test
isLess(10, 15);