| [ Web Proxy ] |
| Viewing: https://developer.mozilla.org/es/docs/Web/JavaScript/Reference/Global_Objects/String/trimEnd | [Back] [Original] |
Get to know MDN better
Esta pgina ha sido traducida del ingls por la comunidad. Aprende ms y nete a la comunidad de MDN Web Docs.
This feature is well established and works across many devices and browser versions. Its been available across browsers since enero de 2020.
El mtodo trimEnd() elimina los espacios en blanco al final de una cadena de carcteres. trimRight() es el alias de este mtodo.
const greeting = " Hello world! ";
console.log(greeting);
// Expected output: " Hello world! ";
console.log(greeting.trimEnd());
// Expected output: " Hello world!";
str.trimEnd(); str.trimRight();
Una nueva cadena de texto que representa la cadena de texto llamada sin espacios en blanco de su extremo (derecho).
trimEnd() / trimRight() Los metodos devuelven una cadena de texto sin espacios en blanco desde su extremo derecho. trimEnd() trimRight() no afectan el valor de la cadena de texto en s.
Por coherencia de funciones como String.prototype.padEnd el nombre del mtodo estandar es trimEnd. Sin embargo por compatibilidad web, trimRight permanece como un alias para trimEnd. En algunos motores esto significa:
String.prototype.trimRight.name === "trimEnd";
trimEnd()El siguiente ejemplo muestra la cadena de texto en minusculas ' foo':
var str = " foo ";
console.log(str.length); // 8
str = str.trimEnd();
console.log(str.length); // 6
console.log(str); // ' foo'
| Specification |
|---|
| ECMAScript 2027 LanguageSpecification # sec-string.prototype.trimend |
This page was last modified on 11 feb 2025 by MDN contributors.
StringString.prototype.anchor()at()String.prototype.big()String.prototype.blink()String.prototype.bold()String.prototype.charAt()String.prototype.charCodeAt()String.prototype.codePointAt()String.prototype.concat()String.prototype.endsWith()String.prototype.fixed()String.prototype.fontcolor()String.prototype.fontsize()String.prototype.includes()String.prototype.indexOf()isWellFormed()String.prototype.italics()String.prototype.lastIndexOf()String.prototype.link()String.prototype.localeCompare()String.prototype.match()String.prototype.matchAll()String.prototype.normalize()padEnd()String.prototype.padStart()String.prototype.repeat()String.prototype.replace()String.prototype.replaceAll()String.prototype.search()String.prototype.slice()String.prototype.small()String.prototype.split()String.prototype.startsWith()String.prototype.strike()String.prototype.sub()String.prototype.substr()String.prototype.substring()String.prototype.sup()String.prototype.toLocaleLowerCase()String.prototype.toLocaleUpperCase()String.prototype.toLowerCase()String.prototype.toString()String.prototype.toUpperCase()toWellFormed()String.prototype.trim()String.prototype.trimEnd()trimStart()String.prototype.valueOf()[Symbol.iterator]()Object/FunctionYour blueprint for a better internet.
Portions of this content are 19982026 by individual mozilla.org contributors. Content available under a Creative Commons license.
| Web Proxy Viewer | New URL | Original Page |