Adds a list or tuple with items to the end of a list, and returns the new length.
This function generates a change (except when called on a variable).
list.extend(list)
Argument | Type | Description |
---|---|---|
list | list/tuple | The list or tuple to extend the list with. |
Returns the new length of the list.
This code extends a list with a given array:
a = [1, 2, 3];
b = [4, 5, 6];
a.extend(b); // returns the new length, 6
a;
Return value in JSON format
[
1,
2,
3,
4,
5,
6
]