Home

function: trimEnd


trimEnd(string: string, chars: string): string

Removes trailing whitespace or specified characters from `string`.

Example(s):

trimEnd('  abc  ')
// => '  abc'

trimEnd('-_-abc-_-', '_-')
// => '-_-abc'

Params:

Name Type Attribute Description
string The string to trim.
chars The characters to trim.

Returns:

string

  {
    "comment": "/**\r\n * Removes trailing whitespace or specified characters from `string`.\r\n *\r\n * @since 4.0.0\r\n * @category String\r\n * @param {string} [string=''] The string to trim.\r\n * @param {string} [chars=whitespace] The characters to trim.\r\n * @returns {string} Returns the trimmed string.\r\n * @see trim, trimStart\r\n * @example\r\n *\r\n * trimEnd('  abc  ')\r\n * // => '  abc'\r\n *\r\n * trimEnd('-_-abc-_-', '_-')\r\n * // => '-_-abc'\r\n */",
    "meta": {
        "range": [
            653,
            979
        ],
        "filename": "trimEnd.js",
        "lineno": 24,
        "path": "C:\\Users\\beaujeup\\projects\\jsdoc-template\\examples\\lodash\\lodash-repo",
        "code": {
            "id": "astnode100010579",
            "name": "trimEnd",
            "type": "FunctionDeclaration",
            "paramnames": [
                "string",
                "chars"
            ]
        },
        "vars": {
            "strSymbols": "trimEnd~strSymbols",
            "end": "trimEnd~end"
        }
    },
    "description": "Removes trailing whitespace or specified characters from `string`.",
    "since": "4.0.0",
    "tags": [
        {
            "originalTitle": "category",
            "title": "category",
            "text": "String",
            "value": "String"
        }
    ],
    "params": [
        {
            "type": {
                "names": [
                    "string"
                ]
            },
            "optional": true,
            "defaultvalue": "''",
            "description": "The string to trim.",
            "name": "string"
        },
        {
            "type": {
                "names": [
                    "string"
                ]
            },
            "optional": true,
            "defaultvalue": "whitespace",
            "description": "The characters to trim.",
            "name": "chars"
        }
    ],
    "returns": [
        {
            "type": {
                "names": [
                    "string"
                ]
            },
            "description": "Returns the trimmed string."
        }
    ],
    "see": [
        "trim, trimStart"
    ],
    "examples": [
        "trimEnd('  abc  ')\r// => '  abc'\r\rtrimEnd('-_-abc-_-', '_-')\r// => '-_-abc'"
    ],
    "name": "trimEnd",
    "longname": "trimEnd",
    "kind": "function",
    "scope": "global",
    "___id": "T000002R000960",
    "___s": true,
    "filepath": "trimEnd.js"
}