Apart from the fact that Underscore escapes backticks and Lodash doesn't, they serve the same purpose and are interchangeable.
The second answer you're linking to contains a remark that Lodash offers the same API as Underscore, but is written to be more performant. I should point out that this remark is no longer true, if it has ever been.
Right from the start, Lodash has diverged significantly from Underscore, introducing more breaking changes with every major release. Although many functions are still roughly the same (such as escape
) the libraries are not interchangeable in general nowadays.
The performance advantage should also be taken with a grain of salt. While Lodash does prioritize performance more than Underscore, most applications will not notice the difference, and there is also some anecdotal evidence of applications actually being a little bit faster with Underscore. Lodash is also four times larger than Underscore. So for a performance-based decision, you should benchmark your application with both libraries (which is not easy in general, given that they are not entirely interchangeable) and then weigh the speed difference against the size difference.
So choose wisely!
Full disclosure: I'm the maintainer of Underscore.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…