Re-creating the Lodash Library inRange


#1

I am getting an error when running
$ node test/in-range.js

Can anyone see what I doing wrong? Thank you.


#2

Your boolean function checking the range excludes the start value whilst the start value should be included. So in your case it should be:

if (value >= start && value < end) {
isInRange = true;
};

#3

Thank you for the help. That would have been a problem.

But it turns out that that was not what was giving me my error. It was the way I was checking if end was undefined. THanks for the help.


#4

Doh… It should have been undefined without the "" right?


#5

I actually just changed it to

if (!end) {

}

and that worked.


#6

Well, somebody have a problem with the terminal. I’ve tried every single way, either on codecademy browser/terminal or mine, i can not route the node test/in-range.js … i’ve tried many different routing, it’s keeping telling me that it do not find the folder. On both browser, either my code is working for sure because i’ve tried it several time on many different ways …