diff options
Diffstat (limited to 'files/pt-br/web/javascript/reference/global_objects/number/valueof')
-rw-r--r-- | files/pt-br/web/javascript/reference/global_objects/number/valueof/index.html | 80 |
1 files changed, 80 insertions, 0 deletions
diff --git a/files/pt-br/web/javascript/reference/global_objects/number/valueof/index.html b/files/pt-br/web/javascript/reference/global_objects/number/valueof/index.html new file mode 100644 index 0000000000..7406994df7 --- /dev/null +++ b/files/pt-br/web/javascript/reference/global_objects/number/valueof/index.html @@ -0,0 +1,80 @@ +--- +title: Number.prototype.valueOf() +slug: Web/JavaScript/Reference/Global_Objects/Number/valueOf +translation_of: Web/JavaScript/Reference/Global_Objects/Number/valueOf +--- +<div>{{JSRef}}</div> + +<p>O método <strong><code>valueOf()</code></strong> retorna o valor primitivo contido no objeto {{jsxref("Number")}}.</p> + +<div>{{EmbedInteractiveExample("pages/js/number-valueof.html")}}</div> + + + +<h2 id="Sintaxe">Sintaxe</h2> + +<pre class="syntaxbox"><var>numObj</var>.valueOf()</pre> + +<h3 id="Valor_retornado">Valor retornado</h3> + +<p>Um número representando o valor primitivo do objeto {{jsxref("Number")}}.</p> + +<h2 id="Descrição">Descrição</h2> + +<p>Este método normalmente é invocado internamente pelo JavaScript e não explicitamente em um código web.</p> + +<h2 id="Exemplos">Exemplos</h2> + +<h3 id="Utilizando_valueOf">Utilizando <code>valueOf</code></h3> + +<pre class="brush: js">var numObj = new Number(10); +console.log(typeof numObj); // object + +var num = numObj.valueOf(); +console.log(num); // 10 +console.log(typeof num); // number +</pre> + +<h2 id="Specifications">Specifications</h2> + +<table class="standard-table"> + <tbody> + <tr> + <th scope="col">Specification</th> + <th scope="col">Status</th> + <th scope="col">Comment</th> + </tr> + <tr> + <td>{{SpecName('ES1')}}</td> + <td>{{Spec2('ES1')}}</td> + <td>Definição inicial. Implementada no JavaScript 1.1.</td> + </tr> + <tr> + <td>{{SpecName('ES5.1', '#sec-15.7.4.4', 'Number.prototype.valueOf')}}</td> + <td>{{Spec2('ES5.1')}}</td> + <td> </td> + </tr> + <tr> + <td>{{SpecName('ES6', '#sec-number.prototype.valueof', 'Number.prototype.valueOf')}}</td> + <td>{{Spec2('ES6')}}</td> + <td> </td> + </tr> + <tr> + <td>{{SpecName('ESDraft', '#sec-number.prototype.valueof', 'Number.prototype.valueOf')}}</td> + <td>{{Spec2('ESDraft')}}</td> + <td> </td> + </tr> + </tbody> +</table> + +<h2 id="Browser_compatibility">Browser compatibility</h2> + +<p class="hidden">The compatibility table in this page is generated from structured data. If you'd like to contribute to the data, please check out <a href="https://github.com/mdn/browser-compat-data">https://github.com/mdn/browser-compat-data</a> and send us a pull request.</p> + +<p>{{Compat("javascript.builtins.Number.valueOf")}}</p> + +<h2 id="See_also">See also</h2> + +<ul> + <li>{{jsxref("Number.prototype.toSource()")}}</li> +</ul> |