fix(curriculum): changing Charles -> Ada in JavaScript challenge descriptions (#42280)
* changing Charles -> Ada in JavaScript challenge descriptions * fix: changing Charles -> Ada in JavaScript challenge descriptions * fix: changing firstName value from Ada to Augusta in javascript lesson
This commit is contained in:
@ -17,7 +17,7 @@ console.log("Alan Peter".length);
|
|||||||
|
|
||||||
The value `10` would be displayed in the console.
|
The value `10` would be displayed in the console.
|
||||||
|
|
||||||
For example, if we created a variable `var firstName = "Charles"`, we could find out how long the string `Charles` is by using the `firstName.length` property.
|
For example, if we created a variable `var firstName = "Ada"`, we could find out how long the string `Ada` is by using the `firstName.length` property.
|
||||||
|
|
||||||
# --instructions--
|
# --instructions--
|
||||||
|
|
||||||
|
@ -11,16 +11,16 @@ dashedName: use-bracket-notation-to-find-the-last-character-in-a-string
|
|||||||
|
|
||||||
In order to get the last letter of a string, you can subtract one from the string's length.
|
In order to get the last letter of a string, you can subtract one from the string's length.
|
||||||
|
|
||||||
For example, if `var firstName = "Charles"`, you can get the value of the last letter of the string by using `firstName[firstName.length - 1]`.
|
For example, if `var firstName = "Ada"`, you can get the value of the last letter of the string by using `firstName[firstName.length - 1]`.
|
||||||
|
|
||||||
Example:
|
Example:
|
||||||
|
|
||||||
```js
|
```js
|
||||||
var firstName = "Charles";
|
var firstName = "Ada";
|
||||||
var lastLetter = firstName[firstName.length - 1];
|
var lastLetter = firstName[firstName.length - 1];
|
||||||
```
|
```
|
||||||
|
|
||||||
`lastLetter` would have a value of the string `s`.
|
`lastLetter` would have a value of the string `a`.
|
||||||
|
|
||||||
# --instructions--
|
# --instructions--
|
||||||
|
|
||||||
|
@ -11,16 +11,16 @@ dashedName: use-bracket-notation-to-find-the-nth-to-last-character-in-a-string
|
|||||||
|
|
||||||
You can use the same principle we just used to retrieve the last character in a string to retrieve the Nth-to-last character.
|
You can use the same principle we just used to retrieve the last character in a string to retrieve the Nth-to-last character.
|
||||||
|
|
||||||
For example, you can get the value of the third-to-last letter of the `var firstName = "Charles"` string by using `firstName[firstName.length - 3]`
|
For example, you can get the value of the third-to-last letter of the `var firstName = "Augusta"` string by using `firstName[firstName.length - 3]`
|
||||||
|
|
||||||
Example:
|
Example:
|
||||||
|
|
||||||
```js
|
```js
|
||||||
var firstName = "Charles";
|
var firstName = "Augusta";
|
||||||
var thirdToLastLetter = firstName[firstName.length - 3];
|
var thirdToLastLetter = firstName[firstName.length - 3];
|
||||||
```
|
```
|
||||||
|
|
||||||
`thirdToLastLetter` would have a value of the string `l`.
|
`thirdToLastLetter` would have a value of the string `s`.
|
||||||
|
|
||||||
# --instructions--
|
# --instructions--
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user