diff options
author | Florian Merz <me@fiji-flo.de> | 2021-02-11 14:45:12 +0100 |
---|---|---|
committer | Florian Merz <me@fiji-flo.de> | 2021-02-11 14:45:12 +0100 |
commit | cb9e359a51c3249d8f5157db69d43fd413ddeda6 (patch) | |
tree | ae3040d626c3b5717da5bda2af9f0a9ff9bd389f /files/ca/web/javascript/reference/global_objects/boolean/tostring/index.html | |
parent | 8260a606c143e6b55a467edf017a56bdcd6cba7e (diff) | |
download | translated-content-cb9e359a51c3249d8f5157db69d43fd413ddeda6.tar.gz translated-content-cb9e359a51c3249d8f5157db69d43fd413ddeda6.tar.bz2 translated-content-cb9e359a51c3249d8f5157db69d43fd413ddeda6.zip |
unslug ca: move
Diffstat (limited to 'files/ca/web/javascript/reference/global_objects/boolean/tostring/index.html')
-rw-r--r-- | files/ca/web/javascript/reference/global_objects/boolean/tostring/index.html | 121 |
1 files changed, 121 insertions, 0 deletions
diff --git a/files/ca/web/javascript/reference/global_objects/boolean/tostring/index.html b/files/ca/web/javascript/reference/global_objects/boolean/tostring/index.html new file mode 100644 index 0000000000..90da6cba3a --- /dev/null +++ b/files/ca/web/javascript/reference/global_objects/boolean/tostring/index.html @@ -0,0 +1,121 @@ +--- +title: Boolean.prototype.toString() +slug: Web/JavaScript/Referencia/Objectes_globals/Boolean/toString +translation_of: Web/JavaScript/Reference/Global_Objects/Boolean/toString +--- +<div>{{JSRef("Global_Objects", "Boolean")}}</div> + +<h2 id="Summary" name="Summary">Resum</h2> + +<p>El mètode <code><strong>toString()</strong></code> retorna una cadena de caràcters que representa l'objecte Boolean.</p> + +<h2 id="Syntax" name="Syntax">Sintaxi</h2> + +<pre class="syntaxbox"><code><var>bool</var>.toString()</code></pre> + +<h3 id="Parameters" name="Parameters">Paràmetres</h3> + +<p>Cap.</p> + +<h2 id="Description" name="Description">Descripció</h2> + +<p>L'objecte {{jsxref("Objectes_standard/Boolean", "Boolean")}} sobreescriu el mètode <code>toString</code> de l'objecte {{jsxref("Objectes_standard/Object", "Object")}}; no hereta {{jsxref("Object.prototype.toString()")}}. Per a objectes de tipus Boolean, el mètode <code>toString</code> retorna una cadena de caràcters que representa l'objecte.</p> + +<p>JavaScript crida el mètode <code>toString</code> de manera automàtica quan aquest ha de ser representat mitjançant text o bé quan un {{jsxref("Objectes_standard/Boolean", "Boolean")}} és referenciat en una concatenació de cadenes de caràcters.</p> + +<p>Per a objectes i valors de tipus {{jsxref("Objectes_standard/Boolean", "Boolean")}}, el mètode <code>toString</code> incorporat retorna la cadena de caràcters "<code>true</code>" o bé "<code>false</code>", depenent del valor de l'objecte booleà.</p> + +<h2 id="Exemples">Exemples</h2> + +<h3 id="Exemple_Utilitzar_toString">Exemple: Utilitzar <code>toString</code></h3> + +<p>Al codi següent <code>flag.toString()</code> retorna "<code>true</code>":</p> + +<pre class="brush: js">var flag = new Boolean(true); +var myVar = flag.toString(); +</pre> + +<h2 id="Especificacions">Especificacions</h2> + +<table class="standard-table"> + <tbody> + <tr> + <th scope="col">Especificació</th> + <th scope="col">Estat</th> + <th scope="col">Comentaris</th> + </tr> + <tr> + <td>ECMAScript 1a Edició. Implementat a JavaScript 1.1</td> + <td>Standard</td> + <td>Definició inicial.</td> + </tr> + <tr> + <td>{{SpecName('ES5.1', '#sec-15.6.4.2', 'Boolean.prototype.toString')}}</td> + <td>{{Spec2('ES5.1')}}</td> + <td> </td> + </tr> + <tr> + <td>{{SpecName('ES6', '#sec-boolean.prototype.tostring', 'Boolean.prototype.toString')}}</td> + <td>{{Spec2('ES6')}}</td> + <td> </td> + </tr> + </tbody> +</table> + +<h2 id="Compatibilitat_amb_navegadors">Compatibilitat amb navegadors</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>{{CompatVersionUnknown}}</td> + <td>{{CompatVersionUnknown}}</td> + <td>{{CompatVersionUnknown}}</td> + <td>{{CompatVersionUnknown}}</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>{{CompatVersionUnknown}}</td> + <td>{{CompatVersionUnknown}}</td> + <td>{{CompatVersionUnknown}}</td> + <td>{{CompatVersionUnknown}}</td> + <td>{{CompatVersionUnknown}}</td> + <td>{{CompatVersionUnknown}}</td> + </tr> + </tbody> +</table> +</div> + +<h2 id="See_also" name="See_also">Vegeu també</h2> + +<ul> + <li>{{jsxref("Object.prototype.toString()")}}</li> +</ul> |