Please note, this is a STATIC archive of website developer.mozilla.org from 03 Nov 2016, cach3.com does not collect or store any user information, there is no "phishing" involved.

String.prototype.trimRight()

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

Característica Chrome Firefox (Gecko) Internet Explorer Opera Safari
Suport bàsic (Yes) 3.5 (1.9.1) Not supported ? ?
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: enTropy
 Last updated by: enTropy,