Non-standard
This feature is non-standard and is not on a standards track. Do not use it on production sites facing the Web: it will not work for every user. There may also be large incompatibilities between implementations and the behavior may change in the future.

El mètode trimRight() elimina els espais en blanc al final d'un string.

Sintaxi

str.trimRight()

Descripció

El mètode trimRight() retorna el string sense espais en blanc al final del mateix. trimRight() no afecta el valor del string sino que en retorna un de nou.

Exemples

Utilitzar trimRight()

L'exemple següent mostra el string ' foo':

var str = '   foo  ';

console.log(str.length); // 8

str = str.trimRight();
console.log(str.length); // 5
console.log(str);        // '   foo'

Especificacions

No forma part de cap standard. Implementat a JavaScript 1.8.1.

Browser compatibility

We're converting our compatibility data into a machine-readable JSON format. This compatibility table still uses the old format, because we haven't yet converted the data it contains. Find out how you can help!

Característica Chrome Firefox (Gecko) Internet Explorer Opera Safari
Suport bàsic (Yes) 3.5 (1.9.1) No support ? ?
Característica Android Chrome for Android Firefox Mobile (Gecko) IE Mobile Opera Mobile Safari Mobile
Suport bàsic ? ? (Yes) ? ? ?

Vegeu també

Document Tags and Contributors

Contributors to this page: teoli, enTropy
Last updated by: teoli,