From a55b575e8089ee6cab7c5c262a7e6db55d0e34d6 Mon Sep 17 00:00:00 2001 From: Florian Merz Date: Thu, 11 Feb 2021 14:46:50 +0100 Subject: unslug es: move --- .../objetos_globales/string/raw/index.html | 112 --------------------- 1 file changed, 112 deletions(-) delete mode 100644 files/es/web/javascript/referencia/objetos_globales/string/raw/index.html (limited to 'files/es/web/javascript/referencia/objetos_globales/string/raw') diff --git a/files/es/web/javascript/referencia/objetos_globales/string/raw/index.html b/files/es/web/javascript/referencia/objetos_globales/string/raw/index.html deleted file mode 100644 index 3c8f3c1d55..0000000000 --- a/files/es/web/javascript/referencia/objetos_globales/string/raw/index.html +++ /dev/null @@ -1,112 +0,0 @@ ---- -title: String.raw() -slug: Web/JavaScript/Referencia/Objetos_globales/String/raw -translation_of: Web/JavaScript/Reference/Global_Objects/String/raw ---- -
{{JSRef}}
- -

El método estatico String.raw()  es una función de  plantilla de literales, similar al prefijo r en Python o al prefijo @ en C# para strings literales (con ciertas diferencias: ver la explicación en este problema). Se utiliza para obtener un string crudo a partir de plantillas de string (es decir, el original, texto no interpretado).

- -

Sintaxis

- -
String.raw(callSite, ...substitutions)
-
-String.raw`templateString`
-
- -

Parametros

- -
-
callSite
-
Plantilla bien estructurada, similar a { raw: ['foo', 'bar', 'baz'] }.
-
...substitutions
-
Contiene valores de sustitución.
-
templateString
-
[opcional] Una plantilla string, con sustituciones (${...}).
-
- -

Valor de regreso

- -

La forma cruda del string de una plantilla string proporcionada.

- -

Excepciones

- -
-
{{jsxref("TypeError")}}
-
Un {{jsxref("TypeError")}} es arrojado si el primer argumento no es un objeto bien estructurado.
-
- -

Descripción

- -

En la mayoría de los casos, String.raw() es usado con plantillas string. La primera sintaxis mencionada arriba es raramente usada,  porque el motor de JavaScript hará la llamada por ti con los argumentos apropiados, al igual que otras funciones de etiqueta.

- -

String.raw() es la unica función de etiqueta incorporada en las plantillas string; trabaja igual que la función de la plantilla por defecto y ejecuta la concatenación. Incluso puedes reimplementarlo con código normal de JavaScript.

- -

Ejemplos

- -

Usando String.raw()

- -
String.raw`Hi\n${2+3}!`;
-// 'Hi\n5!', the character after 'Hi'
-// is not a newline character,
-// '\' and 'n' are two characters.
-
-String.raw`Hi\u000A!`;
-// 'Hi\u000A!', same here, this time we will get the
-//  \, u, 0, 0, 0, A, 6 characters.
-// All kinds of escape characters will be ineffective
-// and backslashes will be present in the output string.
-// You can confirm this by checking the .length property
-// of the string.
-
-let name = 'Bob';
-String.raw`Hi\n${name}!`;
-// 'Hi\nBob!', substitutions are processed.
-
-// Normally you would not call String.raw() as a function,
-// but to simulate `t${0}e${1}s${2}t` you can do:
-String.raw({ raw: 'test' }, 0, 1, 2); // 't0e1s2t'
-// Note that 'test', a string, is an array-like object
-// The following is equivalent to
-// `foo${2 + 3}bar${'Java' + 'Script'}baz`
-String.raw({
-  raw: ['foo', 'bar', 'baz']
-}, 2 + 3, 'Java' + 'Script'); // 'foo5barJavaScriptbaz'
-
-
- -

Especificaciónes

- - - - - - - - - - - - - - - - - - - -
EspecificaciónEstadoComentario
{{SpecName('ES2015', '#sec-string.raw', 'String.raw')}}{{Spec2('ES2015')}}Definicion inicial.
{{SpecName('ESDraft', '#sec-string.raw', 'String.raw')}}{{Spec2('ESDraft')}} 
- -

Compatibilidad de navegador

- - - -

{{Compat("javascript.builtins.String.raw")}}

- -

Tambien ver

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