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
Code a statement that arranges the elements of the array cities in ascending alphabetical order. | cities.sort(); | cities\.sort\(\); | |
After the following statements execute, what is the second element? | const names = ["Meg", "Bo", "Ed"]; names.reverse(); |
"Bo" | •Bo• |
To sort the following array in descending alphabetical order, you need to code 2 statements. What is the first statement? | const names = ["Meg", "Bo", "Ed"]; | names.sort(); | names\.sort\(\); |
To sort the following array in descending alphabetical order, you need to code 2 statements. What is the second statement? | const names = ["Meg", "Bo", "Ed"]; | names.reverse(); | names\.reverse\(\); |
Sort an array in ascending alphabetical order. Make up the array name. | places.sort(); | [a-z_$][a-zA-Z0-9_$]*\.sort\(\); | |
Sort an array in descending alphabetical order. Make up the array name. | places.sort(); places.reverse(); |
([a-z_$][a-zA-Z0-9_$]*)\.sort\(\);[\r\n]\1\.reverse\(\); | |
After the following statements execute, what is the first element in the array? | const numbers = [25, 100, 3]; numbers.sort(); |
100 | 100 |
After the following statements execute, what is the first element in array1? | const array1 = ["Meg", "Bo", "Ed"]; const array2 = array1.sort(); |
"Bo" | •Bo• |
|
|||
|