Skip to content

Commit 1df0e61

Browse files
fix: audit string and variables lectures quizzes reviews (freeCodeCamp#57639)
Co-authored-by: Dario-DC <[email protected]>
1 parent 67e63b5 commit 1df0e61

File tree

9 files changed

+65
-83
lines changed

9 files changed

+65
-83
lines changed

curriculum/challenges/_meta/lecture-working-with-strings-in-javascript/meta.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,14 @@
1010
"id": "672d2654f78cbf20e0ba4501",
1111
"title": "What Is Bracket Notation, and How Do You Access Characters from a String?"
1212
},
13-
{
14-
"id": "673263d58da27ea7809963bf",
15-
"title": "What Are Template Literals, and What Is String Interpolation?"
16-
},
1713
{
1814
"id": "673263df0eb568a7b450f2fc",
1915
"title": "How Do You Create a Newline in Strings and Escape Strings?"
2016
},
17+
{
18+
"id": "673263d58da27ea7809963bf",
19+
"title": "What Are Template Literals, and What Is String Interpolation?"
20+
},
2121
{
2222
"id": "673263e80dd43da7df3ae565",
2323
"title": "How Can You Find the Position of a Substring in a String?"

curriculum/challenges/english/25-front-end-development/lecture-introduction-to-javascript/672d26385dbe73203c4dac81.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ Think about how JavaScript can change the webpage's content or styles without ne
7070

7171
---
7272

73-
JavaScript interacts with the DOM to change content and styles dynamically.
73+
JavaScript interacts with the page to change content and styles dynamically.
7474

7575
---
7676

curriculum/challenges/english/25-front-end-development/lecture-introduction-to-javascript/672d497cb1a1675e47bf7ea1.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ Remember the rules for starting a variable name and avoiding special characters
7474

7575
---
7676

77-
`return`
77+
`const`
7878

7979
### --feedback--
8080

curriculum/challenges/english/25-front-end-development/lecture-introduction-to-javascript/672d49c4e899345f5b33c24c.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ Think about where you can see the results of the `console.log` method.
5050

5151
## --text--
5252

53-
Which of the following examples correctly uses `console.log` to display the value of a variable?
53+
Which of the following examples correctly uses `console.log` to display the value of a string?
5454

5555
## --answers--
5656

@@ -110,11 +110,11 @@ Think about the basic structure of `console.log` and where the variable should g
110110

111111
---
112112

113-
`console.write(age);`
113+
`console.log("age");`
114114

115115
### --feedback--
116116

117-
Think about the basic structure of `console.log` and where the variable should go.
117+
Think about the difference between a variable and a string.
118118

119119
## --video-solution--
120120

curriculum/challenges/english/25-front-end-development/lecture-working-with-data-types/6732518a8627876f4fcd18a4.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ Watch the lecture video and answer the questions below.
1414

1515
## --text--
1616

17-
What does the `typeof` operator return when used on a `string` in JavaScript?
17+
What does the `typeof` operator return when used on a string in JavaScript?
1818

1919
## --answers--
2020

@@ -86,7 +86,7 @@ Recall the unexpected behavior when checking the type of `null`.
8686

8787
## --text--
8888

89-
How does `typeof` behave when checking the type of a `number`?
89+
How does `typeof` behave when checking the type of a number?
9090

9191
## --answers--
9292

curriculum/challenges/english/25-front-end-development/lecture-working-with-strings-in-javascript/672d2654f78cbf20e0ba4501.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,35 +14,35 @@ Watch the video lecture and answer the questions below.
1414

1515
## --text--
1616

17-
What is the index of the character `"b"` in the string `"JavaScript"`?
17+
What is the index of the character `"r"` in the string `"JavaScript"`?
1818

1919
## --answers--
2020

21-
2
21+
`2`
2222

2323
### --feedback--
2424

25-
Remember that index numbers start from 0.
25+
Remember that index numbers start from `0`.
2626

2727
---
2828

29-
4
29+
`4`
3030

3131
### --feedback--
3232

33-
Remember that index numbers start from 0.
33+
Remember that index numbers start from `0`.
3434

3535
---
3636

37-
6
37+
`6`
3838

3939
---
4040

41-
8
41+
`8`
4242

4343
### --feedback--
4444

45-
Remember that index numbers start from 0.
45+
Remember that index numbers start from `0`.
4646

4747
## --video-solution--
4848

curriculum/challenges/english/25-front-end-development/quiz-javascript-strings/66edc31c44f1b9c1d5c5ebca.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,7 @@ developer[2];
205205

206206
#### --text--
207207

208-
How can you obtain the ASCII index of a character in a string?
208+
How can you obtain the ASCII value of a character in a string?
209209

210210
#### --distractors--
211211

@@ -309,23 +309,23 @@ How can you check if the string `"JavaScript"` contains a specific substring?
309309

310310
#### --text--
311311

312-
Which method extracts a substring from the string `"JavaScript"`?
312+
Which of the following extracts the substring `"Script"` from the string `"JavaScript"`?
313313

314314
#### --distractors--
315315

316-
`"JavaScript".remove()`
316+
`"JavaScript".remove(3)`
317317

318318
---
319319

320-
`"JavaScript".extract()`
320+
`"JavaScript".extract(4)`
321321

322322
---
323323

324-
`"JavaScript".cut()`
324+
`"JavaScript".cut(3)`
325325

326326
#### --answer--
327327

328-
`"JavaScript".slice()`
328+
`"JavaScript".slice(4)`
329329

330330
### --question--
331331

curriculum/challenges/english/25-front-end-development/quiz-javascript-variables-and-data-types/66edc25ae5ea80bf6f785552.md

Lines changed: 39 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ Which of the following is NOT a JavaScript data type?
5151

5252
---
5353

54-
`bigint`
54+
`bigInt`
5555

5656
#### --answer--
5757

@@ -87,19 +87,19 @@ Which of the following is a conventional variable name in JavaScript?
8787

8888
#### --distractors--
8989

90-
`let my_var;`
90+
`my_var;`
9191

9292
---
9393

94-
`let my-var;`
94+
`my-var;`
9595

9696
---
9797

98-
`let MyVar;`
98+
`MyVar;`
9999

100100
#### --answer--
101101

102-
`let myVar;`
102+
`myVar;`
103103

104104
### --question--
105105

@@ -109,11 +109,11 @@ What is the difference between `let` and `const` variable declarations in JavaSc
109109

110110
#### --distractors--
111111

112-
`let` is block scoped, `const` is not.
112+
`const` cannot be re-assigned nor re-declared. `let` can be re-assigned and re-declared.
113113

114114
---
115115

116-
`const` is block scoped, `let` is not.
116+
`const` can be re-assigned and re-declared. `let` cannot be re-assigned nor re-declared.
117117

118118
---
119119

@@ -127,23 +127,28 @@ What is the difference between `let` and `const` variable declarations in JavaSc
127127

128128
#### --text--
129129

130-
What is the difference between local and global scope in JavaScript?
130+
What would be the outcome of the following code?
131+
132+
```js
133+
let name = "Andy";
134+
name[0] = "M";
135+
```
131136

132137
#### --distractors--
133138

134-
Variables declared in local scope can be accessed from anywhere in the program.
139+
The value of `name` would be `"MAndy"`.
135140

136141
---
137142

138-
Variables declared in global scope can only be accessed from inside a function.
143+
The value of `name` would be `"Mndy"`.
139144

140145
---
141146

142-
Variables declared in global scope cannot be re-declared.
147+
The value of `name` would still be `"Andy"`.
143148

144149
#### --answer--
145150

146-
Variables declared in global scope can be accessed from anywhere in the program.
151+
It would throw an error.
147152

148153
### --question--
149154

@@ -193,7 +198,7 @@ Adds the string `world` to the variable `hello`, and prints it out in the consol
193198

194199
#### --answer--
195200

196-
Creates a third empty string, copies the values of both strings to it, and finally reassigns the `hello` variable to the third string and prints it out in the console.
201+
Creates a new string that is made of the values of `hello` and `" world"` combined together, and assigns this new string back to `hello` and then prints it out in the console.
197202

198203
### --question--
199204

@@ -375,32 +380,23 @@ Which of the following declares a variable in JavaScript that cannot be changed?
375380

376381
#### --text--
377382

378-
In the code below, which variable is in the global scope in JavaScript:
379-
380-
```js
381-
let a = 0;
382-
383-
if (a < 10) {
384-
let b = 1;
385-
return a + b;
386-
}
387-
```
383+
Which of the following is a valid variable name in JavaScript?
388384

389385
#### --distractors--
390386

391-
Variable `b` is in the global scope.
387+
`tart@n`
392388

393389
---
394390

395-
Both variables `a` and `b` are in the global scope.
391+
`4cats`
396392

397393
---
398394

399-
None of the variables are in the global scope.
395+
`!!dogs`
400396

401397
#### --answer--
402398

403-
Variable `a` is in the global scope, and can be accessed from anywhere in the program.
399+
`$number`
404400

405401
### --question--
406402

@@ -414,7 +410,7 @@ Which of the following is NOT a valid string concatenation method in JavaScript?
414410

415411
---
416412

417-
```console.log(`${string1} ${string2}`);```
413+
``console.log(`${string1} ${string2}`);``
418414

419415
---
420416

@@ -428,79 +424,65 @@ Which of the following is NOT a valid string concatenation method in JavaScript?
428424

429425
#### --text--
430426

431-
What will be the output of the following code:
432-
433-
```js
434-
let hello = "hello";
435-
if (true) {
436-
let world = "world";
437-
}
438-
console.log(hello + " " + world);
439-
```
427+
Which of the following variable names uses camelCase correctly?
440428

441429
#### --distractors--
442430

443-
`hello world`
431+
`a_long_variable_name`
444432

445433
---
446434

447-
`helloworld`
435+
`alongvariableName`
448436

449437
---
450438

451-
`hello`
439+
`ALongVariableName`
452440

453441
#### --answer--
454442

455-
`ReferenceError: world is not defined`
443+
`aLongVariableName`
456444

457445
### --question--
458446

459447
#### --text--
460448

461-
What will be the output of the code below:
462-
463-
```js
464-
const x = 0;
465-
while (x < 10) x++;
466-
console.log(x);
467-
```
449+
Which chatacter JavaScript uses to mark the end of a statement?
468450

469451
#### --distractors--
470452

471-
`10`
453+
`:`
472454

473455
---
474456

475-
`0`
457+
`,`
476458

477459
---
478460

479-
`1 2 3 4 5 6 7 8 9 10`
461+
`.`
480462

481463
#### --answer--
482464

483-
`TypeError: Assignment to constant variable.`
465+
`;`
484466

485467
### --question--
486468

487469
#### --text--
488470

489-
Given the string `freeCodeLamp`, which JavaScript string method can be used to turn it into `freeCodeCamp`?
471+
Which of the following is NOT a JavaScript data type?
490472

491473
#### --distractors--
492474

493-
`"freeCodeLamp"[8] = "C";`
475+
`Symbol`
494476

495477
---
496478

497-
`"freeCodeLamp".charAt(8) = "C";`
479+
`Boolean`
498480

499481
---
500482

501-
`"freeCodeLamp".indexOf("L") = "C";`
483+
`Null`
502484

503485
#### --answer--
504486

505-
`"freeCodeLamp".replace("L", "C");`
487+
`Float`
506488

0 commit comments

Comments
 (0)