---
title: String.prototype.trimRight
---
## String.prototype.trimRight

The `trimRight()` function removes any whitespace characters from the end (the right side) of a given string. It returns a new string. It does not modify the original string.

Examples:
```js
"  This string has two spaces at the beginning and a tab and two spaces at the end.	  ".trimRight();
// output: "  This string has two spaces at the beginning and a tab and two spaces at the end."
```

`trimRight()` removes any whitespace character, not just spaces or tabs.

#### More Information:
- [String.prototype.trimRight() on MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/trimEnd)
