JavaScript String Concatenation — exercises and bug fixes
5 hands-on exercises and 5 find-the-bug challenges for the JavaScript String Concatenation lesson. Every one is checked automatically in the browser — write the code, run it, and the tests tell you what still fails.
Exercises(5)
- 1
Join two names
easy10 minJoin the first and last name with a space.
- 2
Add to a string
easy10 minBuild the text up with the plus-equals operator.
- 3
Repeat a string
easy10 minRepeat the pair of letters three times.
- 4
Force the addition first
easy10 minUse brackets so the numbers add before joining.
- 5
Join an array
medium10 minUse join rather than a loop to build the list.
Find the bug(5)
- 1
Fix the missing space
easy8 minThe names have run together.
- 2
Fix the numbers joined as text
easy8 minBrackets are needed so the addition happens first.
- 3
Fix the total started as text
easy8 minStarting at an empty string joins the numbers instead of adding.
- 4
Fix repeat used with join
easy8 minrepeat takes a count, not a separator.
- 5
Fix the loop that leaves a separator
easy8 minThe trailing separator should not be there.
Ready to write the code?
The editor, the automatic checks and the worked solutions open up with an account.
Open the workspace