Lodash inRange

Hello, I need some help regarding to the Lodash project, specifically the inRange part.
Exercise Link.
Specifically, I do not understand why I get an error at:
2 - Uses end value as start value and start value as 0 if end value is not defined - Failed: _.inRange(1, 2) returned false instead of true.
Any help and guidance is greatly appreciated!

– Source Code –

const _ = {
    clamp(number, lower, upper) {
        if (number > lower && number < upper) {
            let value = number;
            return value;
        }
        else if (number < lower && number < upper) {
            let value = lower;
            return value;
        }
        else if (number > lower && number > upper) {
            let value = upper;
            return value;
        }
    },
    inRange(number, start, end) {
        if (start > number && end < number) {
            return true;
        }
        else if (number < start) {
            return false;
        }
        else if (number >= end ) {
            return false;
        }
        else if (typeof end === 'undefined') {
            end = start;
            start = 0;
            // console.log(" start : " + start);
            // console.log(" end : " + end);
            if (start > end) {
                let temp = end;
                end = start;
                start = temp;
                let isRange = number >= start && number < end;
                return isRange;
            }
        }
        else if (number == start) {
            return true;
        }
        else if (number > start && number < end) {
            return true;
        }
    }
};

_.inRange(5,3);
_.inRange(1,2);



// Do not write or modify code below this line.
module.exports = _;

– Terminal –

node test/in-range.js

– Output –

_.inRange() Tests:
1 - _.inRange() is defined - Passed!
2 - Uses end value as start value and start value as 0 if end value is not defined - Failed: _.inRange(1, 2) returned false instead of true.
3 - Reverses start and end values if start is bigger than end - Passed!
4 - Returns true if an in-range value is in range - Passed!
5 - Returns false if a too small value is out of range - Passed!
6 - Returns false if a too large value is out of range - Passed!
7 - Returns true if provided value is same as start value - Passed!
8 - Returns false if provided value is same as end value - Passed!

Should that if statement be nested? Perhaps that is the problem.

If you’re still working on this, you might try adding in some console.log() statements to follow the control flow of your program. You have a lot of conditional statements (probably more than necessary), and there is likely code that seems like it should be executing that isn’t given the failed input vlaues. If you try something like this, you can see which return statement (if any) is executed.

Your solution will likely require changing the order of some of your conditionals, or possibly rethinking your logic altogether. You may be able to combine some of those conditionals.

One last tip/suggestion: You don’t need to check the typeof end to determine if a value was passed. You can simply check its truthiness: if(end) or if(!end). If no value was supplied for end it will be undefined which is falsy.