Lodash Step 10 in full stack engineering

I’m currently working on the lodash project in the full stack engineering course. I’m stuck on step 10.

Whenever I test the code, I keep getting an error stating that inRange isn’t defined. Here’'s my code. What am I doing wrong?

const _={
clamp(number,lower,upper){
var lowerClampedValue = Math.max(number, lower);
var clampedValue = Math.min(lowerClampedValue, upper);
return clampedValue;
},

inRange(number,start,end){
if(end === undefined){
end = start
start = 0
}
if(start < node end){
var temp = end
end = start
start = temp
}
var isinRange = start <=number && number< end
return isInRange
}

Does it say inRange isn’t defined or isInRange isn’t defined?
I assume the latter, right? Find where it is defined (or where it should be).

Also, where is node defined?

The message I’m getting says that inRange isn’t defined. Is the problem that node isn’t defined?

It looks like inRange is defined, but isinRange is not, and neither is node.

node isn’t defined (and it is the wrong syntax for a condition anyway, what should that do?)
and isInRange isn’t defined. Both is a problem.

That is defined. isInRange isn’t. :slight_smile:

1 Like

This is the message I get in terminal:

1 - _.inRange() is defined - Failed: _.inRange() was not properly defined.
Terminating tests…

How do I fix the code?

Have you tried to correct the two errors we showed you?
From what we see, inRange is properly defined. But there are problems within the method that may cause this – not very precise – error message.

I’ve been trying to fix the two errors but I keep getting a message stating inRange isn’t properly defined.

The first thing to do is copy all your code, then start with just the method definition…

    },
    inRange(number, start, end) {
        return number;
    }

Now run the test and you should get a check mark for inRange is defined. Let us know when you get to this point.

1 Like

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