Languages

JavaScript - Uncaught ReferenceError: _ is not defined

0 points
Asked by:
Gaia-Kirby
720

I've been trying to use underscore (_) in my code and I've got a ReferenceError. Do you know how to fix it?

The error:

My code:

1 answer
0 points
Answered by:
Admin Dirask Community
4380

You need to import underscore.js in your code.

The best way to do it is to create <head> section in your code and import underscore.js there using a <script> tag with CDN URL as a source.

Example <script> with underscore.js v1.13.4 CDN URL:

Full example:

Note:

Go to the Underscore.js site for more information and CDN URLs.

 

References

  1. Underscore.js
0 commentsAdd comment
Donate to Dirask
Our content is created by volunteers - like Wikipedia. If you think, the things we do are good, donate us. Thanks!
Join to our subscribers to be up to date with content, news and offers.
Native Advertising
🚀
Get your tech brand or product in front of software developers.
For more information Contact us
Dirask - we help you to
solve coding problems.
Ask question.

❤️💻 🙂

Join