1
2
3
4
5
6
7
8
9
10
To practice on your own, or to check code you believe shouldn't have been scored as incorrect, go to CodePen.
0,1,2,3,4,5,6,7,8,9
0
0
0
0
What is the keyword for copying a multi-character segment from a string? | slice | slice | |
"scoop" has been assigned to someWord. Copy "oop" out of it,using concise code. Fill in the blank. | let segment = someWord.slice(___); | 2 | 2 |
Fill in the blank to assign the first character of originalString to firstChar. Don't use slice(). | let firstChar = originalString___; | [0] | \[0\] |
Using slice(), change the value of parent from "mother" to "moth". | parent = parent.slice(0, 4); | parent=parent\.slice\(0,4\); | |
Without using slice, display the fifth character in the variable itemNo in an alert. Do it with a single statement. Make up the name of the variable. | alert(itemNo[4]); | alert\([a-z_$][a-zA-Z0-9_$]*\[4\]\); | |
The string "elephant" has been assigned to the variable animal. Copy the four middle characters in the string and assign the copied characters to the variable seg, which hasn't been declared beforehand. | let seg = animal.slice(2, 6); | letseg=animal\.slice\(2,6\); | |
Assign the second through last characters of a variable to a second variable that hasn't been declared beforehand. Make up the variable names. Use concise coding. | let seg = name.slice(1); | let[a-z_$][a-zA-Z0-9_$]*=[a-z_$][a-zA-Z0-9_$]*\.slice\(1\); | |
Given the statement below...
|
let firstName = "gErT"; | firstName = firstName[0].toUpperCase() + firstName.slice(1).toLowerCase(); | firstName=firstName\[0\]\.toUpperCase\(\)\+firstName\.slice\(1\)\.toLowerCase\(\); |
|
|||
|