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
When defining a method, the parameter in the following code would be replaced by the keyword _____. | this.name = name; | function | function |
Complete the line for a method definition in a constructor. | this.calcTotal = __________ | function() { | function\(\){ |
Code the first line of a method definition in a constructor. The name of the method is displayName | this.displayName = function() { | this\.displayName=function\(\){ | |
Code the first line of a constructor definition. The name of the constructor is Planet. It has a single parameter, size. | function Planet(size) { | functionPlanet\(size\){ | |
Code the first line of a method definition in a constructor. Make up the name of the method. | this.compare = function() { | this\.[a-z_$][a-zA-Z0-9_$]*=function\(\){ | |
Code the first line of a method definition in a constructor. It has two parameters. Make up all the names. | this.compare = function(firstContestant, secondContestant); | this\.[a-z_$][a-zA-Z0-9_$]*=function\([a-z_$][a-zA-Z0-9_$]*,[a-z_$][a-zA-Z0-9_$]*\); | |
Code a constructor for an object that has one property and one method. The method displays the value of the property in an alert. Make up the names. Don't forget that the method definition ends with a semicolon. | function Holiday(name) { this.name = name; this.displayName = function() { alert(this.name); }; } |
function[A-Z][a-zA-Z0-9_$]*\(([a-z_$][a-zA-Z0-9_$]*)\){[\r\n]this\.\1=\1;[\r\n]this\.[a-z_$][a-zA-Z0-9_$]*=function\(\){[\r\n]alert\(this\.\1\);[\r\n]};[\r\n]} | |
Call a constructor to create an object with three string properties. Make up everything. | const thirdCat = new Cat("Carmine", "tabby", "9"); | const[a-z_$][a-zA-Z0-9_$]*=new[A-Z][a-zA-Z0-9_$]*\(•.*•,•.*•,•.*•\); | |
|
|||
|