Recreating Lodash : Purpose of functions like .drop()

What is the purpose of libraries like LoDash having certain functions, like .drop(), which seem to offer no more benefit/functionality than the already built-in Javascript function (in this case: array.slice().

For example, Javascript’s built-in function for .slice() (linked above) offers this:

var animals = ['ant', 'bison', 'camel', 'duck', 'elephant'];

// expected output: Array ["camel", "duck", "elephant"]

console.log(animals.slice(2, 4));
// expected output: Array ["camel", "duck"]

console.log(animals.slice(1, 5));
// expected output: Array ["bison", "camel", "duck", "elephant"]

And the .drop() function for LoDash (linked above) offers this:

_.drop([1, 2, 3]);
// => [2, 3]
_.drop([1, 2, 3], 2);
// => [3]
_.drop([1, 2, 3], 5);
// => []
_.drop([1, 2, 3], 0);
// => [1, 2, 3]

Isn’t LoDash’s drop function just a redundant function that will ultimately add increasing amount of milliseconds to the speed of execution? Still early in my learning path here so tell me if I am missing something.

Working on tasks #31-34 in the Recreating LoDash inspired this question.


There are differences, though subtle.

.slice() is a method of the Array.prototype object.

.drop() is a method of the _ object.

.slice() returns an array composed of sliced elements in the target array (from any index in any amount within range). The target array is not mutated.

.drop() returns the mutated target array with the selected elements removed. The elements are always removed from the beginning of the array.

Granted, this is only speaking of the obvious, which can be stipulated. Far be it for me to begin to theorize or qualify the performance or logical differences. Hopefully someone can come in who will demonstrate along these lines.