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
If the value of nums is [1, 2, 3, 4] what is the value of test when the following code executes? | let test = nums.includes(5); | false | false |
What is the value of anArray when the following code executes? | let anArray = Array.from("Hi"); | ["H","i"] | \[•H•,•i•\] |
Check whether "salt" is an element in the variable ingredients and assign the result to a new variable, isSalt. | let isSalt = ingredients.includes("salt"); | letisSalt=ingredients\.includes\(•salt•\); | |
A string has been assigned to the variable x. Convert the string into an array and assign the array to y, which hasn't been previously declared. | let y = Array.from(x); | lety=Array\.from\(x\); | |
Convert 1, 2, 3 to [1,2,3] and assign the array to nums, a variable that hasn't been previously declared. | let nums = Array.of(1, 2, 3); | letnums=Array\.of\(1,2,3\); | |
Convert a string to an array of the individual characters and assign the array to a variable that hasn't previously been declared. Make up everything. | let chars = Array.from("Ko"); | let[a-z_$][a-zA-Z0-9_$]*=Array\.from\(•.*•\); | |
Check whether an integer is present in an array and assign the result to a new variable. Make up everything. | let test = nums.includes(100); | let[a-z_$][a-zA-Z0-9_$]*=[a-z_$][a-zA-Z0-9_$]*\.includes\((0|-?[1-9][\d]*)\); | |
Assign a string to a variable that hasn't previously been delcared. In a single statement display an array created from it. | let eyeColor = "brown"; alert(Array.from(eyeColor)); |
let([a-z_$][a-zA-Z0-9_$]*)=•.*•;[\r\n]alert\(Array\.from\(\1\)\); | |
|
|||
|