Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ReferenceError: _ is not defined #2722

Closed
Francefire opened this issue Jan 26, 2018 · 5 comments
Closed

ReferenceError: _ is not defined #2722

Francefire opened this issue Jan 26, 2018 · 5 comments

Comments

@Francefire
Copy link

After having some trouble installing underscore (because it's not underscore.js but only underscore), I try to use a underscore function (_.once) but I get this error, I have const Underscore = require("underscore") on the top of my code, but still, and when I try const Underscore = require("underscore.js") it doesn't find the modul, so you could please enlighten me ?

I'm a reall beginner at JavaScript, forgive me if I do something obviously wrong ;p

@Rayraz
Copy link

Rayraz commented Jan 27, 2018

Your code assigns the underscore library to a constant named Underscore.
What I think you want is: const _ = require("underscore"); which will assign the underscore library to a constant named _.

@Francefire
Copy link
Author

Omg thanks, since I didn't take any lesson of javascript I wasn't understanding what did this command really means, but now I got it, thanks :D

@olivier-voutat
Copy link

Your code assigns the underscore library to a constant named Underscore.
What I think you want is: const _ = require("underscore"); which will assign the underscore library to a constant named _.

Was looking this for hours...

@naveenkumargc
Copy link

Your code assigns the underscore library to a constant named Underscore.
What I think you want is: const _ = require("underscore"); which will assign the underscore library to a constant named _.

Thank you. this works when you are working on react application also.

@ErvinRrahmani
Copy link

Your code assigns the underscore library to a constant named Underscore.
What I think you want is: const _ = require("underscore"); which will assign the underscore library to a constant named _.

thnx a lot

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants