diff --git a/docs/text/sourcetext.md b/docs/text/sourcetext.md index b74ebb6..177216b 100644 --- a/docs/text/sourcetext.md +++ b/docs/text/sourcetext.md @@ -6,6 +6,23 @@ These functions are accessible on the [Text.sourceText](text.md#textsourcetext) --- +## JavaScript String methods + +When the JavaScript expression engine is active, After Effects interprets a Source Text value as a JavaScript String. Because the current property is the default object for an expression, supported String instance methods can be called without an explicit receiver. + +For example, if the Source Text value is `"AE"`, each of these expressions returns `"AEAEAE"`: + +```js +repeat(3); +value.repeat(3); +text.sourceText.repeat(3); +``` + +!!! note + `repeat()` is the standard JavaScript [`String.prototype.repeat()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/repeat) method, not a global After Effects method. The receiver-less form is specific to a Source Text expression and is undefined on numeric properties. To repeat a different string, call the method on that string explicitly, such as `"AE".repeat(3)`. + +--- + ## Attributes ### SourceText.isHorizontalText