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
A function that creates objects is a (one word)_______ | constructor | constructor | |
Fill in the blank. Make up the name. (Remember the naming convention for this type of function. | function _______(name, area, population) { | The first character is capitalized: Nation not nation | [A-Z][a-zA-Z0-9_$]* |
The constructor's name is Student. Fill in the blank to call it. | const student404 = ____________("Sigel", "Efrem", 12, 89); | new Student | newStudent |
The name of the constructor is Planet. Code the first line of the function, including the parameters distance and mass. | function Planet(distance, mass) { | functionPlanet\(distance,mass\){ | |
The name of the constructor is Planet. Code the complete function, including the parameters distance and mass. The property names are the same as the parameter names. | function Planet(distance, mass) { this.distance = distance; this.mass = mass; } |
functionPlanet\(distance,mass\){[\r\n]this\.distance=distance;[\r\n]this\.mass=mass;[\r\n]} | |
Code a constructor function that has a single parameter. The property name is not the same as the parameter name. Make up all the names. | function Patient(x) { this.age = x; } |
function[A-Z][a-zA-Z0-9_$]*\(([a-z_$][a-zA-Z0-9_$]*)\){[\r\n]this\.[a-z_$][a-zA-Z0-9_$]*=\1;[\r\n]} | |
Create an object by calling a constructor named Product. Include two arguments, the product's name and the product's color. Make up everything except the constructor function name. | const sku2191 = new Product("frisbee", "white"); | const[a-z_$][a-zA-Z0-9_$]*=newProduct\(•.*•,•.*•\); | |
Code a constructor function with two parameters. The names of the parameters and the names of the properties are the same. Make up everything. | function Vehicle(make, model) { this.make = make; this.model = model; } |
function[A-Z][a-zA-Z0-9_$]*\(([a-z_$][a-zA-Z0-9_$]*),([a-z_$][a-zA-Z0-9_$]*)\){[\r\n]this\.\1=\1;[\r\n]this\.\2=\2;[\r\n]} | |
|
|||
|