add(item, index)
Class: List.
Description:
Adds a list item at the end of the list, or inserts the item at specified index.
Parameters:
| Name | Type | Description |
|---|---|---|
|
|
string | number | ListItem |
List item as a string, number, or ListItem formatted object. |
|
|
number |
Integer position at which to add the item. |
Returns:
Returns an index at which the item was inserted, or -1 if item was not inserted for some reason.
Type: number
Examples:
const i = combo1.add({text: "New Item", ...more optional properties}); // Adding item as object
const i = combo1.add("New Item"); // Adding item as string
const i = combo1.add(45); // Adding item as number
