What is the keyword that allows all objects created by a particular constructor to share the same property or function?
Sorry, that's incorrect. The correct answer:
prototype
This is the first line of a prototype statement that creates a prototype method for the constructor MakeObj. Fill in the blank.
MakeObj.________.calcTax = function(price) {
Sorry, that's incorrect. The correct answer:
prototype
This is the first line of a prototype statement that creates a prototype method for the constructor Product. Fill in the blank.
______.prototype.selectPkg = function(dimensions, weight) {
Sorry, that's incorrect. An example:
Product
This is the first line of a prototype statement that creates a prototype method for the constructor Product. The method has no parameters. Fill in the blank.
Product.prototype.totalCosts = _____________
Sorry, the correct answer is:
function() {
Drag-and-drop. Code a prototype method with one parameter, message, called displayIt for a constructor called MakeAlert.
Click in the box and type the next character. I'll autocomplete. Don't type spaces.
Code a prototype property called brand for a constructor called Part. Its value is "Acme"
The correct code is:
Part.prototype.brand = "Acme";
Fail-safe coding. If you type the wrong character, I'll cancel the keystroke. Type spaces.
Code the first line of a prototype method called calcTime for a constructor called Recipe
The correct code is:
Recipe.prototype.calcTime = function() {
Code a statement that creates a prototype number property.
Sorry, that's incorrect. An example:
Product.prototype.caseQty = 12;
There is a prototype property, caseQty, for the constructor Product. Its value is 12. Make an exception for product332. Its caseQty is 6.
Sorry, that's incorrect. The correct code:
product332.caseQty = 6;
Code a method prototype that has no parameters and does nothing.
Sorry, that's incorrect. An example:
MakeObj.prototype.doNothing = function() {
};
Code a method prototype that displays a message. The message text is passed to the method by the statement that calls the method, not by the constructor.
Sorry, that's incorrect. An example:
MakeObj.prototype.dispMess = function(message) {
alert(message);
};
Code a method prototype that displays a message. The message text is passed to the method by the constructor, not the statement that calls the method.
Sorry, that's incorrect. An example: MakeObj.prototype.dispMess = function() {
alert(this.message);
};
Time goal: 30 seconds. Code a statement that creates a prototype number property.
Sorry, that's incorrect. An example:
Product.prototype.caseQty = 12;
Time goal: 30 seconds. There is a prototype property, caseQty, for the constructor Product. Its value is 12. Make an exception for product332. Its caseQty is 6.
Sorry, that's incorrect. The correct code:
product332.caseQty = 6;
Time goal: 60 seconds. Code the first line of a prototype method without parameters.
Sorry, that's incorrect. An example:
MakeObj.prototype.doNothing = function() {
Time goal: 75 seconds. Code a method prototype that displays a message. The message text is passed to the method by the statement that calls the method, not by the constructor.
Sorry, that's incorrect. An example:
MakeObj.prototype.dispMess = function(message) {
alert(message);
};
Time goal: 75 seconds. Code a method prototype that displays a message. The message text is passed to the method by the constructor, not the statement that calls the method.
Sorry, that's incorrect. An example: MakeObj.prototype.dispMess = function() {
alert(this.message);
};
Time goal: 90 seconds. Code an empty constructor function. Then give it a prototype method that has no parameters and does nothing.
Sorry, that's incorrect. An example:
function MakeObj() {
}
MakeObj.prototype.doNothing = function() {
};
Don't change my code. Don't copy and paste. It may not work.
To practice on your own, or to check code you believe shouldn't have been scored as incorrect, go to jsFiddle. See my brief demo of jsFiddle.
Post a review on Amazon for the paperback or the Kindle edition.
Email me to give me a compliment, complaint, or correction. I'll respond.
0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19