diff options
| author | Ryan Johnson <rjohnson@mozilla.com> | 2021-04-29 16:16:42 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-04-29 16:16:42 -0700 |
| commit | 95aca4b4d8fa62815d4bd412fff1a364f842814a (patch) | |
| tree | 5e57661720fe9058d5c7db637e764800b50f9060 /files/ca/web/javascript/reference/global_objects/number/toprecision/index.html | |
| parent | ee3b1c87e3c8e72ca130943eed260ad642246581 (diff) | |
| download | translated-content-95aca4b4d8fa62815d4bd412fff1a364f842814a.tar.gz translated-content-95aca4b4d8fa62815d4bd412fff1a364f842814a.tar.bz2 translated-content-95aca4b4d8fa62815d4bd412fff1a364f842814a.zip | |
remove retired locales (#699)
Diffstat (limited to 'files/ca/web/javascript/reference/global_objects/number/toprecision/index.html')
| -rw-r--r-- | files/ca/web/javascript/reference/global_objects/number/toprecision/index.html | 135 |
1 files changed, 0 insertions, 135 deletions
diff --git a/files/ca/web/javascript/reference/global_objects/number/toprecision/index.html b/files/ca/web/javascript/reference/global_objects/number/toprecision/index.html deleted file mode 100644 index 79166a8749..0000000000 --- a/files/ca/web/javascript/reference/global_objects/number/toprecision/index.html +++ /dev/null @@ -1,135 +0,0 @@ ---- -title: Number.prototype.toPrecision() -slug: Web/JavaScript/Reference/Global_Objects/Number/toPrecision -translation_of: Web/JavaScript/Reference/Global_Objects/Number/toPrecision -original_slug: Web/JavaScript/Referencia/Objectes_globals/Number/toPrecision ---- -<div>{{JSRef}}</div> - -<p>El mètode <strong><code>toPrecision()</code></strong> retorna un string que representa l'objecte {{jsxref("Number")}} amb la precisió especificada.</p> - -<h2 id="Sintaxi">Sintaxi</h2> - -<pre class="syntaxbox"><code><var>numObj</var>.toPrecision([<em>precisió</em>])</code></pre> - -<h3 id="Paràmetres">Paràmetres</h3> - -<dl> - <dt><code>precisió</code></dt> - <dd>Opional. Un nombre sencer que indica el nombre de dígits significatius.</dd> -</dl> - -<h3 id="Valor_retornat">Valor retornat</h3> - -<p>Un string que representa un objecte {{jsxref("Number")}} en notació de punt fix o bé en notació exponencial, arrodonit a <code>precisió</code> dígits significatius. Vegeu la discussió sobre arrodoniment a la descripció del mètode {{jsxref("Number.prototype.toFixed()")}}, que també s'aplica a <code>toPrecision()</code>.</p> - -<p>Si s'omet l'argument <code>precisió</code>, es comporta com {{jsxref("Number.prototype.toString()")}}. Si l'argument <code>precisió</code> no és un nombre sencer, aquest s'arrodoneix al nombre sencer més proper.</p> - -<h3 id="Excepcions_llençades">Excepcions llençades</h3> - -<dl> - <dt>{{jsxref("Global_Objects/RangeError", "RangeError")}}</dt> - <dd>Si el valor de precisió no està entre 1 i 100 (ambdós inclusius), es llença un <a class="new" href="https://developer.mozilla.org/ca/docs/Web/JavaScript/Referencia/RangeError" title="Aquesta pàgina encara no ha estat traduïda. Si us plau considera contribuir-hi!"><code>RangeError</code></a>. Les implementacions poden opcionalment donar suport per a valors més grans o petits. ECMA-262 tan sols requereix una precisió de fins a 21 dígits significatius.</dd> -</dl> - -<h2 id="Exemples">Exemples</h2> - -<h3 id="Utilitzar_toPrecision">Utilitzar <code>toPrecision</code></h3> - -<pre class="brush: js">var numObj = 5.123456; - -console.log(numObj.toPrecision()); // escriu 5.123456 -console.log(numObj.toPrecision(5)); // escriu 5.1235 -console.log(numObj.toPrecision(2)); // escriu 5.1 -console.log(numObj.toPrecision(1)); // escriu 5 - -// fixeu-vos que la notació exponencial pot retornar-se en algunes circumstàncies -console.log((1234.5).toPrecision(2)); // escriu 1.2e+3 -</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>{{SpecName('ES3')}}</td> - <td>{{Spec2('ES3')}}</td> - <td>Definició inicial. Implementat a 1.5.</td> - </tr> - <tr> - <td>{{SpecName('ES5.1', '#sec-15.7.4.7', 'Number.prototype.toPrecision')}}</td> - <td>{{Spec2('ES5.1')}}</td> - <td> </td> - </tr> - <tr> - <td>{{SpecName('ES6', '#sec-number.prototype.toprecision', 'Number.prototype.toPrecision')}}</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="Vegeu_també">Vegeu també</h2> - -<ul> - <li>{{jsxref("Number.prototype.toFixed()")}}</li> - <li>{{jsxref("Number.prototype.toExponential()")}}</li> - <li>{{jsxref("Number.prototype.toString()")}}</li> -</ul> |
