Created
July 31, 2022 16:11
-
-
Save harithzainudin/ff97381208ee383adf4504ea0f9dff52 to your computer and use it in GitHub Desktop.
Difference between Lodash concat & Javascript native concat
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const _ = require("lodash"); | |
const myClassmates = ["John", "Jane"]; | |
const mySenior = ["Alice", "Bob"]; | |
console.time("Native concat"); | |
const students2 = myClassmates.concat(mySenior); | |
console.timeEnd("Native concat"); | |
console.time("Lodash concat"); | |
const students = _.concat(myClassmates, mySenior); | |
console.timeEnd("Lodash concat"); | |
// Both result will be - [ 'John', 'Jane', 'Alice', 'Bob' ] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment