Lodash project inrange error

hi all,

in : https://www.codecademy.com/paths/front-end-engineer-career-path/tracks/fecp-javascript-syntax-part-ii/modules/fecp-practice-javascript-syntax-arrays-loops-objects-iterators/projects/lodash

i typed:

var _ ={

  clamp (number, lower, upper) {

    var lowerClampedValue = Math.max(number , lower);

    var ClampedValue = Math.min(lowerClampedValue , upper);

    return ClampedValue;

  }

inRange(num,start,end) {

    if (end === undefined) {

      end === start && start === 0;

    }

    if (start > end) {

      let temp = end;

      end = start;

      start = temp;

      }

    var isInRange = start <= num && num < end ? true : false;

    return isInRange;

      };

};

      

// Do not write or modify code below this line.

module.exports = _;

after save and run (( $ node test/in-range.js ))

the terminal reply :
/home/ccuser/workspace/underscore-javascript-capstone/_.js:8
inRange(num,start,end) {
^^^^^^^
SyntaxError: Unexpected identifier
at createScript (vm.js:53:10)
at Object.runInThisContext (vm.js:95:10)
at Module._compile (module.js:543:28)
at Object.Module._extensions…js (module.js:580:10)
at Module.load (module.js:488:32)
at tryModuleLoad (module.js:447:12)
at Function.Module._load (module.js:439:3)
at Module.require (module.js:498:17)
at require (internal/module.js:20:19)
at Object. (/home/ccuser/workspace/underscore-javascript-capstone/test/in-range.js:1:73)

why ??

Hi and welcome to the forum.
You forgot to separate your previous method from the current one with a comma.

And what do you intend to do here? It looks as if you check a condition, but inside the function scope without anything to follow.

1 Like

I did the comma and it works thanks…

but this error can I pass it ?
5 - Uses end value as start value and start value as 0 if end value is not defined - Failed: _.inRange(1, 2) returned false instead of true.

Did you tackle this one? You’re not doing anything inside that function scope.

i did in :

if (end === undefined) {

      end === start;

      start === 0;

    }

This is more of the same. You are using the comparison operator, but I guess you want to do an assignment?

thank soooooooooooooooooo much it work with only = not ===

1 Like