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
Fill in the blank to check whether the object has the property status. | let hasStatus = ______ in flight44; | "status" | •status• |
Fill in the blank to check whether the object flight44 has the property. | let hasStatus = "status" ________; | in flight44 | inflight44 |
Check whether the object loris has the property cuteness and assign the result to the variable hasProperty, which hasn't been declared beforehand. | let hasProperty = "cuteness" in loris; | lethasProperty=•cuteness•inloris; | |
Check whether the object loris has the method measureSpeed() and assign the result to the variable hasMethod, which hasn't been declared beforehand. | let hasMethod = "measureSpeed" in loris; | lethasMethod=•measureSpeed•inloris; | |
Check whether an object has a particular property and assign the result to a variable that hasn't been declared beforehand. Make up everything. | let result = "color" in shape11; | let[a-z_$][a-zA-Z0-9_$]*=•.*•in[a-z_$][a-zA-Z0-9_$]*; | |
Below is an empty array. Loop through the properties of an object, adding each property in turn to the array. Make up everything except the array name. | const props = []; | for (let aProp in thing12) { props.push(aProp); } |
for\(let([a-z_$][a-zA-Z0-9_$]*)in[a-z_$][a-zA-Z0-9_$]*\){[\r\n]props\.push\(\1\);[\r\n]} |
Check whether a property exists that is not inherited, and assign the result to a variable, which hasn't been declared beforehand. Make up all the names. | let result = thing12.hasOwnProperty("height"); | let[a-z_$][a-zA-Z0-9_$]*=[a-z_$][a-zA-Z0-9_$]*\.hasOwnProperty\(•.*•\); | |
If a property exists, assign an integer value to it. Make up everything. | if ("points" in thing12) { thing12.points = 5; } |
if\(•([a-z_$][a-zA-Z0-9_$]*)•in([a-z_$][a-zA-Z0-9_$]*)\){[\r\n]\2\.\1=(0|-?[1-9][\d]*);[\r\n]} | |
|
|||
|