'How to use Lodash

I would simply like to use the functions from Lodash in my website.

I included in the <head> section:

<script scr="https://cdn.jsdelivr.net/npm/[email protected]/lodash.min.js"></script>

Not sure what else I should do? I tried to add:

<script>
var _ = require('lodash'); 
</script>

But I get the following error: Uncaught ReferenceError: require is not defined



Solution 1:[1]

<script src="https://cdn.jsdelivr.net/npm/[email protected]/lodash.min.js"></script>
<script src="lodash.js"></script>

Put this two lines of code in head, and you are ready to use Lodash in your javascript files.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Ilija Radovanović