Exam Name: | Salesforce Certified JavaScript Developer I (SU24) | ||
Exam Code: | JavaScript-Developer-I Dumps | ||
Vendor: | Salesforce | Certification: | Salesforce Developer |
Questions: | 215 Q&A's | Shared By: | elyza |
A developer has a formatName function that takes two arguments, firstName and lastName and returns a string. They want to schedule the
function to run once after five seconds.
What is the correct syntax to schedule this function?
A class was written to represent items for purchase in an online store, and a second class
Representing items that are on sale at a discounted price. THe constructor sets the name to the
first value passed in. The pseudocode is below:
Class Item {
constructor(name, price) {
… // Constructor Implementation
}
}
Class SaleItem extends Item {
constructor (name, price, discount) {
...//Constructor Implementation
}
}
There is a new requirement for a developer to implement a description method that will return a
brief description for Item and SaleItem.
Let regItem =new Item(‘Scarf’, 55);
Let saleItem = new SaleItem(‘Shirt’ 80, -1);
Item.prototype.description = function () { return ‘This is a ’ + this.name;
console.log(regItem.description());
console.log(saleItem.description());
SaleItem.prototype.description = function () { return ‘This is a discounted ’ +
this.name; }
console.log(regItem.description());
console.log(saleItem.description());
What is the output when executing the code above ?