Files
.github
api-server
client
config
curriculum
challenges
_meta
arabic
chinese
english
portuguese
russian
spanish
01-responsive-web-design
02-javascript-algorithms-and-data-structures
basic-algorithm-scripting
basic-data-structures
basic-javascript
access-array-data-with-indexes.spanish.md
access-multi-dimensional-arrays-with-indexes.spanish.md
accessing-nested-arrays.spanish.md
accessing-nested-objects.spanish.md
accessing-object-properties-with-bracket-notation.spanish.md
accessing-object-properties-with-dot-notation.spanish.md
accessing-object-properties-with-variables.spanish.md
add-new-properties-to-a-javascript-object.spanish.md
add-two-numbers-with-javascript.spanish.md
adding-a-default-option-in-switch-statements.spanish.md
appending-variables-to-strings.spanish.md
assignment-with-a-returned-value.spanish.md
build-javascript-objects.spanish.md
chaining-if-else-statements.spanish.md
comment-your-javascript-code.spanish.md
comparison-with-the-equality-operator.spanish.md
comparison-with-the-greater-than-operator.spanish.md
comparison-with-the-greater-than-or-equal-to-operator.spanish.md
comparison-with-the-inequality-operator.spanish.md
comparison-with-the-less-than-operator.spanish.md
comparison-with-the-less-than-or-equal-to-operator.spanish.md
comparison-with-the-strict-equality-operator.spanish.md
comparison-with-the-strict-inequality-operator.spanish.md
comparisons-with-the-logical-and-operator.spanish.md
comparisons-with-the-logical-or-operator.spanish.md
compound-assignment-with-augmented-addition.spanish.md
compound-assignment-with-augmented-division.spanish.md
compound-assignment-with-augmented-multiplication.spanish.md
compound-assignment-with-augmented-subtraction.spanish.md
concatenating-strings-with-plus-operator.spanish.md
concatenating-strings-with-the-plus-equals-operator.spanish.md
constructing-strings-with-variables.spanish.md
count-backwards-with-a-for-loop.spanish.md
counting-cards.spanish.md
create-decimal-numbers-with-javascript.spanish.md
declare-javascript-variables.spanish.md
declare-string-variables.spanish.md
decrement-a-number-with-javascript.spanish.md
delete-properties-from-a-javascript-object.spanish.md
divide-one-decimal-by-another-with-javascript.spanish.md
divide-one-number-by-another-with-javascript.spanish.md
escape-sequences-in-strings.spanish.md
escaping-literal-quotes-in-strings.spanish.md
find-the-length-of-a-string.spanish.md
finding-a-remainder-in-javascript.spanish.md
generate-random-fractions-with-javascript.spanish.md
generate-random-whole-numbers-with-javascript.spanish.md
generate-random-whole-numbers-within-a-range.spanish.md
global-scope-and-functions.spanish.md
global-vs.-local-scope-in-functions.spanish.md
golf-code.spanish.md
increment-a-number-with-javascript.spanish.md
initializing-variables-with-the-assignment-operator.spanish.md
introducing-else-if-statements.spanish.md
introducing-else-statements.spanish.md
iterate-odd-numbers-with-a-for-loop.spanish.md
iterate-through-an-array-with-a-for-loop.spanish.md
iterate-with-javascript-do...while-loops.spanish.md
iterate-with-javascript-for-loops.spanish.md
iterate-with-javascript-while-loops.spanish.md
local-scope-and-functions.spanish.md
logical-order-in-if-else-statements.spanish.md
manipulate-arrays-with-pop.spanish.md
manipulate-arrays-with-push.spanish.md
manipulate-arrays-with-shift.spanish.md
manipulate-arrays-with-unshift.spanish.md
manipulating-complex-objects.spanish.md
modify-array-data-with-indexes.spanish.md
multiple-identical-options-in-switch-statements.spanish.md
multiply-two-decimals-with-javascript.spanish.md
multiply-two-numbers-with-javascript.spanish.md
nest-one-array-within-another-array.spanish.md
nesting-for-loops.spanish.md
passing-values-to-functions-with-arguments.spanish.md
practice-comparing-different-values.spanish.md
profile-lookup.spanish.md
quoting-strings-with-single-quotes.spanish.md
record-collection.spanish.md
replacing-if-else-chains-with-switch.spanish.md
return-a-value-from-a-function-with-return.spanish.md
return-early-pattern-for-functions.spanish.md
returning-boolean-values-from-functions.spanish.md
selecting-from-many-options-with-switch-statements.spanish.md
shopping-list.spanish.md
stand-in-line.spanish.md
store-multiple-values-in-one-variable-using-javascript-arrays.spanish.md
storing-values-with-the-assignment-operator.spanish.md
subtract-one-number-from-another-with-javascript.spanish.md
testing-objects-for-properties.spanish.md
understand-string-immutability.spanish.md
understanding-boolean-values.spanish.md
understanding-case-sensitivity-in-variables.spanish.md
understanding-undefined-value-returned-from-a-function.spanish.md
understanding-uninitialized-variables.spanish.md
updating-object-properties.spanish.md
use-bracket-notation-to-find-the-first-character-in-a-string.spanish.md
use-bracket-notation-to-find-the-last-character-in-a-string.spanish.md
use-bracket-notation-to-find-the-nth-character-in-a-string.spanish.md
use-bracket-notation-to-find-the-nth-to-last-character-in-a-string.spanish.md
use-conditional-logic-with-if-statements.spanish.md
use-multiple-conditional-ternary-operators.spanish.md
use-the-conditional-ternary-operator.spanish.md
use-the-parseint-function-with-a-radix.spanish.md
use-the-parseint-function.spanish.md
using-objects-for-lookups.spanish.md
word-blanks.spanish.md
write-reusable-javascript-with-functions.spanish.md
debugging
es6
functional-programming
intermediate-algorithm-scripting
javascript-algorithms-and-data-structures-projects
object-oriented-programming
regular-expressions
03-front-end-libraries
04-data-visualization
06-information-security-and-quality-assurance
08-coding-interview-prep
09-certificates
formattingConversion
math-challenges
requiresTests
schema
test
.babelrc
.editorconfig
.npmignore
.travis.yml
CHANGELOG.md
LICENSE.md
commitizen.config.js
commitlint.config.js
create-challenge-bundle.js
getChallenges.js
gulpfile.js
index.js
lib.js
md-translation.js
package-entry.js
package-lock.json
package.json
utils.js
docs
guide
mock-guide
tools
.editorconfig
.eslintignore
.eslintrc.json
.gitattributes
.gitignore
.node-inspectorrc
.prettierrc
.snyk
.travis.yml
.vcmrc
CODE_OF_CONDUCT.md
CONTRIBUTING.md
Dockerfile.tests
LICENSE.md
README.french.md
README.italian.md
README.md
change_volumes_owner.sh
docker-compose-shared.yml
docker-compose.tests.yml
docker-compose.yml
lerna.json
netlify.toml
package-lock.json
package.json
sample.env
freeCodeCamp/curriculum/challenges/spanish/02-javascript-algorithms-and-data-structures/basic-javascript/escape-sequences-in-strings.spanish.md

68 lines
3.8 KiB
Markdown
Raw Normal View History

2018-10-08 13:34:43 -04:00
---
id: 56533eb9ac21ba0edf2244b6
title: Escape Sequences in Strings
challengeType: 1
2018-10-10 16:20:40 -04:00
videoUrl: ''
localeTitle: Secuencias de escape en cuerdas
2018-10-08 13:34:43 -04:00
---
## Description
2018-10-10 16:20:40 -04:00
<section id="description"> Las comillas no son los únicos caracteres que pueden <dfn>escaparse</dfn> dentro de una cadena. Hay dos razones para usar caracteres que se escapan: primero es permitirle usar caracteres que de otra forma no podría escribir, como un retroceso. El segundo es permitirte representar múltiples citas en una cadena sin que JavaScript interprete mal lo que quieres decir. Aprendimos esto en el reto anterior. <table class="table table-striped"><thead><tr><th> Código </th><th> Salida </th></tr></thead><tbody><tr><td> <code>\&#39;</code> </td> <td> una frase </td></tr><tr><td> <code>\&quot;</code> </td> <td> doble cita </td></tr><tr><td> <code>\\</code> </td> <td> barra invertida </td></tr><tr><td> <code>\n</code> </td> <td> nueva línea </td></tr><tr><td> <code>\r</code> </td> <td> retorno de carro </td></tr><tr><td> <code>\t</code> </td> <td> lengüeta </td></tr><tr><td> <code>\b</code> </td> <td> retroceso </td></tr><tr><td> <code>\f</code> </td> <td> form feed </td></tr></tbody></table> <em>Tenga en cuenta que la barra invertida debe escaparse para mostrarse como una barra invertida.</em> </section>
2018-10-08 13:34:43 -04:00
## Instructions
2018-10-10 16:20:40 -04:00
<section id="instructions"> Asigne las siguientes tres líneas de texto a la única variable <code>myStr</code> usando secuencias de escape. <blockquote> Primera linea <br> \Segunda linea <br> Tercera linea </blockquote> Deberá usar secuencias de escape para insertar caracteres especiales correctamente. También deberá seguir el espaciado como se ve arriba, sin espacios entre las secuencias de escape o las palabras. Aquí está el texto con las secuencias de escape escritas. <q>FirstLine <code>newline</code> <code>tab</code> <code>backslash</code> SecondLine <code>newline</code> ThirdLine</q> </section>
2018-10-08 13:34:43 -04:00
## Tests
<section id='tests'>
```yml
tests:
- text: <code>myStr</code> no debe contener espacios
testString: 'assert(!/ /.test(myStr), "<code>myStr</code> should not contain any spaces");'
2018-10-10 16:20:40 -04:00
- text: '<code>myStr</code> debe contener las cadenas <code>FirstLine</code> , <code>SecondLine</code> y <code>ThirdLine</code> (recuerde la sensibilidad a mayúsculas)'
2018-10-08 13:34:43 -04:00
testString: 'assert(/FirstLine/.test(myStr) && /SecondLine/.test(myStr) && /ThirdLine/.test(myStr), "<code>myStr</code> should contain the strings <code>FirstLine</code>, <code>SecondLine</code> and <code>ThirdLine</code> (remember case sensitivity)");'
- text: <code>FirstLine</code> debe ir seguido del carácter de nueva línea <code>\n</code>
testString: 'assert(/FirstLine\n/.test(myStr), "<code>FirstLine</code> should be followed by the newline character <code>\n</code>");'
- text: <code>myStr</code> debe contener un carácter de tabulación <code>\t</code> que sigue a un carácter de nueva línea
testString: 'assert(/\n\t/.test(myStr), "<code>myStr</code> should contain a tab character <code>\t</code> which follows a newline character");'
- text: <code>SecondLine</code> debe ir precedida por el carácter de barra invertida <code>\\</code>
testString: 'assert(/\SecondLine/.test(myStr), "<code>SecondLine</code> should be preceded by the backslash character <code>\\</code>");'
- text: Debe haber un carácter de nueva línea entre <code>SecondLine</code> y <code>ThirdLine</code>
testString: 'assert(/SecondLine\nThirdLine/.test(myStr), "There should be a newline character between <code>SecondLine</code> and <code>ThirdLine</code>");'
```
</section>
## Challenge Seed
<section id='challengeSeed'>
<div id='js-seed'>
```js
var myStr; // Change this line
```
</div>
### After Test
<div id='js-teardown'>
```js
console.info('after the test');
```
</div>
</section>
## Solution
<section id='solution'>
```js
2018-10-10 16:20:40 -04:00
// solution required
2018-10-08 13:34:43 -04:00
```
</section>