Re-creating the Lodash Library inRange


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

Can anyone see what I doing wrong? Thank you.


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;


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.


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


I actually just changed it to

if (!end) {


and that worked.