最新的Salesforce Certified JavaScript Developer - Multiple Choice - JS-Dev-101免費考試真題
for (let number = 2; number <= 5; number += 1) {
// faster code statement here
}
Which statement meets the requirements to log an error when the Boolean statement evaluates to false?
// faster code statement here
}
Which statement meets the requirements to log an error when the Boolean statement evaluates to false?
正確答案: D
說明:(僅 Fast2test 成員可見)
Refer to the code below (assuming Promise.race is intended):
let cat3 = new Promise(resolve =>
setTimeout(resolve, 3000, "Cat 3 completes")
);
Promise.race([cat1, cat2, cat3])
.then(value => {
let result = `${value} the race.`;
})
.catch(err => {
console.log("Race is cancelled:", err);
});
(Assuming cat1 and cat2 are similar to earlier examples: cat2 resolves fastest.) What is the value of result when Promise.race executes?
let cat3 = new Promise(resolve =>
setTimeout(resolve, 3000, "Cat 3 completes")
);
Promise.race([cat1, cat2, cat3])
.then(value => {
let result = `${value} the race.`;
})
.catch(err => {
console.log("Race is cancelled:", err);
});
(Assuming cat1 and cat2 are similar to earlier examples: cat2 resolves fastest.) What is the value of result when Promise.race executes?
正確答案: A
說明:(僅 Fast2test 成員可見)
A developer has two ways to write a function:
Option A:
01 function Monster() {
02 this.growl = () => {
03 console.log("Grr!");
04 }
05 }
Option B:
01 function Monster() {};
02 Monster.prototype.growl = () => {
03 console.log("Grr!");
04 }
After deciding on an option, the developer creates 1000 monster objects. How many growl methods are created with Option A and Option B?
Option A:
01 function Monster() {
02 this.growl = () => {
03 console.log("Grr!");
04 }
05 }
Option B:
01 function Monster() {};
02 Monster.prototype.growl = () => {
03 console.log("Grr!");
04 }
After deciding on an option, the developer creates 1000 monster objects. How many growl methods are created with Option A and Option B?
正確答案: D
說明:(僅 Fast2test 成員可見)
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. There is a new requirement for a developer to implement a description method that will return a brief description for Item and SaleItem.
01 let regItem = new Item('Scarf', 55);
02 let saleItem = new SaleItem('Shirt', 80, .1);
03 Item.prototype.description = function() { return 'This is a ' + this.name; }
04 console.log(regItem.description());
05 console.log(saleItem.description());
06
07 SaleItem.prototype.description = function() { return 'This is a discounted ' + this.name; } What is the output when executing the code above?
01 let regItem = new Item('Scarf', 55);
02 let saleItem = new SaleItem('Shirt', 80, .1);
03 Item.prototype.description = function() { return 'This is a ' + this.name; }
04 console.log(regItem.description());
05 console.log(saleItem.description());
06
07 SaleItem.prototype.description = function() { return 'This is a discounted ' + this.name; } What is the output when executing the code above?
正確答案: D
說明:(僅 Fast2test 成員可見)
01 function Monster() { this.name = 'hello'; };
02 const m = Monster();
What happens due to the missing new keyword?
02 const m = Monster();
What happens due to the missing new keyword?
正確答案: B
說明:(僅 Fast2test 成員可見)
A developer publishes a new version of a package with new features that do not break backward compatibility. The previous version number was 1.1.3.
Following semantic versioning formats, what should the new package version number be?
Following semantic versioning formats, what should the new package version number be?
正確答案: D
說明:(僅 Fast2test 成員可見)