import lodash
// import entire library
import _ from "lodash"
const nums = [1, 2, 2, 3, 1, 4]
let res = _.uniq(nums)
// import methods by name
// Still loads entire lodash library!!
import { uniq } from "lodash"
const nums = [1, 2, 2, 3, 1, 4]
let res = uniq(nums) // better readability
// import only what you need
import uniq from "loadash/uniq"
const nums = [1, 2, 2, 3, 1, 4]
let res = uniq(nums)
Also in JavaScript:
- redux devtools with middleware
- copy to clipboard javascript dom
- javascript remove event listener after bind
- angular material table
- error page vue
- how to add up all the numbers in between 0 and that number
- url_for javascipt
- save a dict to json python
- moving letters animation javascript
- javaascript all
- const{}=
- js remove readonly attribute
- how to access property of nested unnamed array
- compare objects in javascript
- ckeditor ignore contenteditable
- how to change an html element using javascript
- javascript function optional parameter
- jquery first child
- creating a nested loop of a chessboard in javascript
- js date difference in seconds
- send variable data from node js to front end javascript
- how to use the map method in javascript
- await inside map js
- angular http call caching issue even after no-cache