From 074785cea106179cb3305637055ab0a009ca74f2 Mon Sep 17 00:00:00 2001 From: Peter Bengtsson Date: Tue, 8 Dec 2020 14:42:52 -0500 Subject: initial commit --- .../global_objects/array/tolocalestring/index.html | 140 +++++++++++++++++++++ 1 file changed, 140 insertions(+) create mode 100644 files/pt-br/web/javascript/reference/global_objects/array/tolocalestring/index.html (limited to 'files/pt-br/web/javascript/reference/global_objects/array/tolocalestring') diff --git a/files/pt-br/web/javascript/reference/global_objects/array/tolocalestring/index.html b/files/pt-br/web/javascript/reference/global_objects/array/tolocalestring/index.html new file mode 100644 index 0000000000..7912113ff7 --- /dev/null +++ b/files/pt-br/web/javascript/reference/global_objects/array/tolocalestring/index.html @@ -0,0 +1,140 @@ +--- +title: Array.prototype.toLocaleString() +slug: Web/JavaScript/Reference/Global_Objects/Array/toLocaleString +translation_of: Web/JavaScript/Reference/Global_Objects/Array/toLocaleString +--- +
{{JSRef}}
+ +
O método toLocaleString() retorna uma representaçao de elementos de um array. Os elementos são convertidos para Strings utilizando seus respectivos métodos toLocaleString e essas cadeias são separadas por uma sequência específica de localidade (separados por virgula ","). 
+ +
 
+ +

Sintaxe

+ +
array.toLocaleString();
+
+ +

 

+ +

Parâmetros

+ +
+
locales {{optional_inline}}
+
Uma string com uma tag de linguagem BCP 47, ou um array como strings. Para uma forma geral e uma interpretação do arquivo locales, veja a página {{jsxref("Intl")}}.
+
options {{optional_inline}}
+
Um objeto com as propriedades de configurações, para números veja {{jsxref("Number.prototype.toLocaleString()")}}, e para datas veja {{jsxref("Date.prototype.toLocaleString()")}}.
+
+ +

Retorno

+ +

Uma string que representa os elementos de um array.

+ +

Exemplos

+ +

Usando toLocaleString

+ +

Os elementos de um array são convertidos para strings usando seus respectivos métodos toLocaleString:

+ + + +
var numero = 1337;
+var data = new Date();
+var meuArray = [numero, data, 'foo'];
+
+var resultado = meuArray.toLocaleString();
+
+console.log(resultado);
+// saída '1337,July 26, 2015 at 20:02:23 GMT-3,foo'
+// se estiver no Brasil com o fuso horario GMT-0300 (BRT) de Brasília.
+
+ +

Para mais exemplos, veja as páginas {{jsxref("Intl")}}, {{jsxref("NumberFormat")}}, e {{jsxref("DateTimeFormat")}}.

+ +

Especificações

+ + + + + + + + + + + + + + + + + + + + + + + + +
EspecificaçãoStatusComentários
{{SpecName('ES3')}}{{Spec2('ES3')}}Definição inicial.
{{SpecName('ES5.1', '#sec-15.2.4.3', 'Array.prototype.toLocaleString')}}{{Spec2('ES5.1')}} 
{{SpecName('ES6', '#sec-array.prototype.tolocalestring', 'Array.prototype.toLocaleString')}}{{Spec2('ES6')}} 
+ +

Compatibilidade do Browser

+ +
{{CompatibilityTable}}
+ +
+ + + + + + + + + + + + + + + + + + + +
FeatureChromeFirefox (Gecko)Internet ExplorerOperaSafari
Suporte Básico{{CompatVersionUnknown}}{{CompatVersionUnknown}}{{CompatVersionUnknown}}{{CompatVersionUnknown}}{{CompatVersionUnknown}}
+
+ +
+ + + + + + + + + + + + + + + + + + + + + +
FeatureAndroidChrome for AndroidFirefox Mobile (Gecko)IE MobileOpera MobileSafari Mobile
Suporte Básico{{CompatVersionUnknown}}{{CompatVersionUnknown}}{{CompatVersionUnknown}}{{CompatVersionUnknown}}{{CompatVersionUnknown}}{{CompatVersionUnknown}}
+
+ +

Veja também

+ + -- cgit v1.2.3-54-g00ecf