Slice does not modify the original array, but instead returns a shallow copy of elements from the original array.
This function is valid in
v2.0.0 to v2.23.0.
This function has been downloaded 48 times.
Array or array-like object to shallow copy.
Zero-based index at which to begin extraction. A negative index can be used, indicating an offset from the end of the sequence.
slice(array,-2) extracts the last two elements in the sequence. If
undefined, slice begins from index
Zero-based index before which to end extraction. slice extracts up to but not including
end. For example,
slice(array,1,4) extracts the second element through the fourth element (elements indexed 1, 2, and 3). A negative index can be used, indicating an offset from the end of the sequence.
slice(array,2,-1) extracts the third element through the second-to-last element in the sequence. If
end is omitted,
slice extracts through the end of the sequence (
end is greater than the length of the sequence, slice extracts through the end of the sequence (
A new array containing the extracted elements.
This function directly requires the following function which is included automatically:
Binds a context to a given function within that context.
This function is directly required by the following functions:
Attempts to call a function if one exists at the given path starting at the given root object.
Creates a function that when called will call
this referring to
objThis and any values in
opt_args be passed as the first arguments to
Calls a function whether it be a global prototype function or a YourJS function or a custom bindable.
Makes multiple calls using the YourJS
Puts a cap (limit) on the amount of arguments that a function can receive.
Creates a wrapper function for a prototype function that can be capped (limited in the amount of arguments it can receive).
Creates a chained version of a value.
Constructs an object with an arbitrary number of arguments passed via an array (or an array-like object).
Creates a wrapper function that will only execute the given function once the number of arguments passed is at least a given amount. If the wrapper is called with too few arguments, those arguments will be recursively stored within a new wrapper function.
Converts supplementary latin letters into basic latin letters, removing the diacritical marks. In other words this normalizes a string.
Defers calling a function until the current call stack is done. Similar to using the global
Calls a function after a given amount of time. This is very similar to the global
Creates a new array which is the difference of the two given arrays.
Execute a function every so often. Similar to
Determines whether a specific test passes for all of the items in an array.
Calls a function and returns it so it can be called again.
Finds the first item in an array which matches the specified criteria.
Tests to see if two or more values are exactly the same. This is similar to
=== but will also indicate that
NaN and will indicate that
-0 is not
Checks to see if a value is of a specific kind.
Creates a partial isKind() function.
Determine whether or not a RegExp matches an entire string (or the start of a string).
Creates a partial
Creates a copy of a function with the left-most arguments preset.
Creates a partial function where the arguments in any position can be set. Also allows for setting the value of
Creates a new wrapper function that will call the original the arguments in a different order.
Creates a wrapper function that if called with more arguments than specified, those arguments will be passed in as an array in the final argument.
Takes an array (or an array-like object) or a string, copies it, and returns the copy in reverse order.
Takes an array and returns a new array with some or all of the original values not usually in the same order.
Duplicates an array or a string and adds and/or removes one or more values from it. NOTE: This is different from the traditional splice function because it doesn't modify the array, but rather it returns a modified duplicate.
Calls a function while flattening first-level array-like arguments so as the spread those individual values and use them as individual arguments.
Passes an array as the arguments to a construct thusly allowing a variable number of arguments to be passed to the constructor.
Turns anything into an array.
Toggles values in an array, adding the values that are missing from the array and removing those that are there.
Unbinds a value from a function (such as a prototypal function) and creates a wrapper function that when called will use the 1st argument as the bound value.
Creates a new version of an array with all of the duplicate values removed.
Creates a waiter function which takes orders and serves orders in a way and calls a ready function when all orders have been served.