Back to Content

SVGLengthList: getItem() method

files/en-us/web/api/svglengthlist/getitem/index.md

latest788 B
Original Source

{{APIRef("SVG")}}

The getItem() method of the {{domxref("SVGLengthList")}} interface returns the specified item from the list. The returned item is the item itself and not a copy. Any changes made to the item are immediately reflected in the list. The first item is indexed 0.

Syntax

js-nolint
getItem(index)

Parameters

  • index
    • : A non-negative integer that specifies the index of the item to retrieve.

Return value

The {{domxref("SVGLength")}} at the specified index in the list.

Exceptions

  • IndexSizeError {{domxref("DOMException")}}
    • : Thrown when the index is out of bounds for the list.

Examples

See {{domxref("SVGLengthList")}} for a complete example.

Specifications

{{Specifications}}

Browser compatibility

{{Compat}}