/
index.md
45 lines (31 loc) · 1000 Bytes
/
index.md
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
---
title: "CharacterData: substringData() method"
short-title: substringData()
slug: Web/API/CharacterData/substringData
page-type: web-api-instance-method
browser-compat: api.CharacterData.substringData
---
{{APIRef("DOM")}}
The **`substringData()`** method of the {{domxref("CharacterData")}} interface
returns a portion of the existing data,
starting at the specified index
and extending for a given number of characters afterwards.
## Syntax
```js-nolint
domString = characterData.substringData(offset, count)
```
### Parameters
- `offset`
- : The index of the first character to include in the returned substring.
`0` is the first character of the string.
- `count`
- : The number of characters to return.
### Return value
A string with the substring.
## Exceptions
- `IndexSizeError` {{domxref("DOMException")}}
- : Thrown if `offset` + `count` is larger than the length of the contained data.
## Specifications
{{Specifications}}
## Browser compatibility
{{Compat}}