Re-creating lodash inRange() testing

Here is the link to the project I am working on.
https://www.codecademy.com/paths/web-development/tracks/web-dev-js-arrays-loops-objects/modules/pjs-javascript-capstone/projects/lodash

When I go to test my inRange() method within the command line I keep getting an error and I don’t understand why.

$ node test/in-range.js 
_.inRange() Tests: 
: 1 - _.inRange() is defined - Failed: _.inRange() was not properly defined.

Here is my code

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 > end){
      var temp = end 
      end = start 
      start = temp
    }
    var isInRange = start <= number && number < end 
    return isInRange
  }
};


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

Hi there, welcome to the forums. :slight_smile:

Did you remember to click the Save button at the bottom of the code editor before running node test/in-range.js in the Bash terminal? :slight_smile:

1 Like

I feel so dumb,

Thank you, that worked :blush:

1 Like

You shouldn’t.

I did the same thing a few times whilst doing the Lodash project… :smiley:

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