trim
Removes the spaces, tabs and line breaks at both ends of the text.
Runs on: either side: the compiler places the statement that calls it where the values it uses live.
Format:
trim(text)
Parameters:
| Parameter | Type | Description |
|---|---|---|
| text | string | the text |
Returned Value:
| Type | Description |
|---|---|
| string | the text without its surrounding whitespace |
Examples
if (trim(answer) == "") { alert("Please type an answer") }