aboutsummaryrefslogtreecommitdiff
path: root/files/ca/web/javascript/reference/global_objects/string/trimend/index.html
blob: ee22825fc46079ad38fb467e41f00ef7fb771196 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
---
title: String.prototype.trimRight()
slug: Web/JavaScript/Reference/Global_Objects/String/trimEnd
translation_of: Web/JavaScript/Reference/Global_Objects/String/trimEnd
original_slug: Web/JavaScript/Referencia/Objectes_globals/String/TrimRight
---
<div>{{JSRef}} {{non-standard_header}}</div>

<p>El mètode <strong><code>trimRight()</code></strong> elimina els espais en blanc al final d'un string.</p>

<h2 id="Sintaxi">Sintaxi</h2>

<pre class="syntaxbox"><code><var>str</var>.trimRight()</code></pre>

<h2 id="Descripció">Descripció</h2>

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

<h2 id="Exemples">Exemples</h2>

<h3 id="Utilitzar_trimRight()">Utilitzar <code>trimRight()</code></h3>

<p>L'exemple següent mostra el string <code>' foo'</code>:</p>

<pre class="brush: js; highlight: [5]">var str = '   foo  ';

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

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

<h2 id="Especificacions">Especificacions</h2>

<p>No forma part de cap standard. Implementat a JavaScript 1.8.1.</p>

<h2 id="Browser_compatibility">Browser compatibility</h2>

<div>{{CompatibilityTable}}</div>

<div id="compat-desktop">
<table class="compat-table">
 <tbody>
  <tr>
   <th>Característica</th>
   <th>Chrome</th>
   <th>Firefox (Gecko)</th>
   <th>Internet Explorer</th>
   <th>Opera</th>
   <th>Safari</th>
  </tr>
  <tr>
   <td>Suport bàsic</td>
   <td>{{CompatVersionUnknown}}</td>
   <td>{{CompatGeckoDesktop("1.9.1")}}</td>
   <td>{{CompatNo}}</td>
   <td>{{CompatUnknown}}</td>
   <td>{{CompatUnknown}}</td>
  </tr>
 </tbody>
</table>
</div>

<div id="compat-mobile">
<table class="compat-table">
 <tbody>
  <tr>
   <th>Característica</th>
   <th>Android</th>
   <th>Chrome for Android</th>
   <th>Firefox Mobile (Gecko)</th>
   <th>IE Mobile</th>
   <th>Opera Mobile</th>
   <th>Safari Mobile</th>
  </tr>
  <tr>
   <td>Suport bàsic</td>
   <td>{{CompatUnknown}}</td>
   <td>{{CompatUnknown}}</td>
   <td>{{CompatVersionUnknown}}</td>
   <td>{{CompatUnknown}}</td>
   <td>{{CompatUnknown}}</td>
   <td>{{CompatUnknown}}</td>
  </tr>
 </tbody>
</table>
</div>

<h2 id="Vegeu_també">Vegeu també</h2>

<ul>
 <li>{{jsxref("String.prototype.trim()")}}</li>
 <li>{{jsxref("String.prototype.trimLeft()")}} {{non-standard_inline}}</li>
</ul>