Lodash project javascript error

HI All,

I have been having an error message when running the lodash project.

The error is pointing out the ‘module’ as an unexpected identifier.
This is not part of the code that I had written. I have not modified it.
Is there a problem with the server?
I have tried logging out then in again. No success.
Here is the erros message:

node test/clamp.js
/home/ccuser/workspace/underscore-javascript-capstone/_.js:45
module.exports = _;
^^^^^^
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/clamp.js:1:73)
$

Thank you for your help,

Kalman

Please link to the exercise, and especially, post your code. We interpret that error as a missing object.

const _ = {
  clamp (lower, upper, n) {
    return n
  }
}

That’s the object being exported as a module.

This is the code I have done:

const _= {
clamp(number,lower,upper){
let lowerClampedValue=Math.max(number,lower);
let clampedValue=Math.min(lowerClampedValue,upper);
return clampedValue;
},
The link to the exercise:
https://www.codecademy.com/paths/full-stack-engineer-career-path/tracks/fscp-javascript-syntax-part-ii/modules/fecp-practice-javascript-syntax-arrays-loops-objects-iterators/projects/lodash

Thanks for your help,

1 Like

Hi There,

Figured it out eventually. I looked through the code and a } was missing.
Thanks again.

Kalman

1 Like

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