This repository was archived by the owner on Jun 2, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 56
$.drop()
Arthur Guiot edited this page Jul 12, 2017
·
1 revision
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.
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.
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]Don't hesitate to ask your questions
- Home
- The Core Languages
- Getting Started: Installation
- The Basics (
$.var()+$.target()) - Developing for DisplayJS
-
$.select()- Text related
- If...else
$.xss()$.repeat()$.custom()$.live()$.load()$.on()$.onEvent()$.ready()- Scroll API
$.all()$.clone()$.is()$.valEmpty()$.remove()$.show()&$.hide()$.ajax()- Class Related
$.css()$.getStyle()- Fade effects
$.extend()$.dynamic()$.parent()- Elements-Nodes
$.component()$.time_ago()$.copy()$.then()$.sleep()$.getProp()