mirror of
https://github.com/freeCodeCamp/freeCodeCamp.git
synced 2026-05-28 18:26:54 +00:00
fix(curriculum): updated comprehension check questions for string concatenation lecture (#58742)
This commit is contained in:
committed by
GitHub
parent
4738dd91ea
commit
0af92b02b5
+20
-25
@@ -124,47 +124,47 @@ Think about how you combine text in JavaScript.
|
||||
|
||||
## --text--
|
||||
|
||||
Which of the following code examples uses the `+=` operator correctly for string concatenation?
|
||||
Which of the following is the correct way to concatenate strings?
|
||||
|
||||
## --answers--
|
||||
|
||||
```js
|
||||
let greeting = 'Hi';
|
||||
greeting = greeting + ' there!';
|
||||
let greeting = "Hi";
|
||||
greeting -= " there!";
|
||||
```
|
||||
|
||||
### --feedback--
|
||||
|
||||
Look for the option that appends text to an existing string.
|
||||
Refer to the middle of the video where this was discussed.
|
||||
|
||||
---
|
||||
|
||||
```js
|
||||
let greeting = 'Hi';
|
||||
greeting =+ ' there!';
|
||||
let greeting = "Hi";
|
||||
greeting =+ " there!";
|
||||
```
|
||||
|
||||
### --feedback--
|
||||
|
||||
Look for the option that appends text to an existing string.
|
||||
Refer to the middle of the video where this was discussed.
|
||||
|
||||
---
|
||||
|
||||
```js
|
||||
let greeting = 'Hi';
|
||||
greeting += ' there!';
|
||||
let greeting = "Hi";
|
||||
greeting += " there!";
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
```js
|
||||
let greeting = 'Hi';
|
||||
greeting == ' there!';
|
||||
let greeting = "Hi";
|
||||
greeting == " there!";
|
||||
```
|
||||
|
||||
### --feedback--
|
||||
|
||||
Look for the option that appends text to an existing string.
|
||||
Refer to the middle of the video where this was discussed.
|
||||
|
||||
## --video-solution--
|
||||
|
||||
@@ -172,41 +172,36 @@ Look for the option that appends text to an existing string.
|
||||
|
||||
## --text--
|
||||
|
||||
What will be the output of the following code?
|
||||
Which of the following is the correct method to concatenate multiple strings?
|
||||
|
||||
```js
|
||||
let str1 = "Hello";
|
||||
let str2 = "World";
|
||||
let result = str1.concat(", ", str2, "!");
|
||||
```
|
||||
|
||||
## --answers--
|
||||
|
||||
`"HelloWorld!"`
|
||||
`concatenate()`
|
||||
|
||||
### --feedback--
|
||||
|
||||
Consider how the concat() method works with strings and multiple arguments.
|
||||
Refer to the end of the video where this was discussed.
|
||||
|
||||
---
|
||||
|
||||
`"Hello, World!"`
|
||||
`concat()`
|
||||
|
||||
---
|
||||
|
||||
`"Hello, World !"`
|
||||
`concatenating()`
|
||||
|
||||
### --feedback--
|
||||
|
||||
Consider how the `concat()` method works with strings and multiple arguments.
|
||||
Refer to the end of the video where this was discussed.
|
||||
|
||||
---
|
||||
|
||||
`"Hello World!"`
|
||||
`concats()`
|
||||
|
||||
### --feedback--
|
||||
|
||||
Consider how the `concat()` method works with strings and multiple arguments.
|
||||
Refer to the end of the video where this was discussed.
|
||||
|
||||
## --video-solution--
|
||||
|
||||
|
||||
Reference in New Issue
Block a user