1.8 KiB
1.8 KiB
id, title, localeTitle, challengeType
id | title | localeTitle | challengeType |
---|---|---|---|
bd7123c9c450eddfaeb5bdef | Use Bracket Notation to Find the Nth Character in a String | Usa la notación de corchete para encontrar el enésimo carácter de una cadena | 1 |
Description
0
, por lo que el primer carácter es en realidad el carácter cero.
Instructions
thirdLetterOfLastName
para que sea igual a la tercera letra de la variable lastName
usando notación de corchete.
Pista Intenta mirar la declaración de la variable
secondLetterOfFirstName
si te quedas atascado.
Tests
tests:
- text: La variable <code>thirdLetterOfLastName</code> debe tener el valor de <code>v</code> .
testString: 'assert(thirdLetterOfLastName === "v", "The <code>thirdLetterOfLastName</code> variable should have the value of <code>v</code>.");'
- text: Usted debe utilizar la notación de soporte.
testString: 'assert(code.match(/thirdLetterOfLastName\s*?=\s*?lastName\[.*?\]/), "You should use bracket notation.");'
Challenge Seed
// Example
var firstName = "Ada";
var secondLetterOfFirstName = firstName[1];
// Setup
var lastName = "Lovelace";
// Only change code below this line.
var thirdLetterOfLastName = lastName;
After Test
console.info('after the test');
Solution
var lastName = "Lovelace";
var thirdLetterOfLastName = lastName[2];