Error re-creating lodash inRange

Hi there,

I cant’ manage to find the error in my code, even after using the help video, I keep having this error : 1 - _.inRange() is defined - Failed: _.inRange() was not properly defined.

I didn’t have any issue with the clamp method though.
From the error code, my guess is it comes from the scope, but I don’t see where.

Thank you very much !

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


module.exports = _;```

var isInRange = start <= number &&& number < end
there is no &&& in JS, I’m sure that && is what you want.

and don’t forget to click save before running node test/in-range.js.

Ah thank you for that, I was far from looking at this.

1 Like