How it works?

This function is pretty useful because it will remove a defined amount of items in an array, starting from the right or from the left. Which means that if you give an array ([0, 1, 2, 3, 4, 5]), and you give the number 2, it will return [2, 3, 4, 5]. But if you gave the number -2, it would have returned [0, 1, 2, 3]. If you're understanding that, you'll have no problem using it.

How to use it?

This function will require 2 arguments which are:

  • array
  • val, this is the number that will cut the array from the right or from the left.

    Example

    We'll do the 2 examples I showed you:

JS:

$.drop($.range(5), 2) //  [2, 3, 4, 5]
$.drop($.range(5), -2) // [0, 1, 2, 3]

⚠️ Questions?

Don't hesitate to ask your questions ⁉️ in the issue part 😁

results matching ""

    No results matching ""