Salesforce Certified JavaScript Developer - Multiple Choice - JS-Dev-101 FREE EXAM DUMPS QUESTIONS & ANSWERS
Refer to the code below:
let strNumber = '12345';
Which code snippet shows a correct way to convert this string to an integer?
let strNumber = '12345';
Which code snippet shows a correct way to convert this string to an integer?
Correct Answer: D
Vote an answer
Explanation: Only visible for FreeCram members. You can sign-up / login (it's free).
Corrected code:
let obj = {
foo: 1,
bar: 2
};
let output = [];
for (let something in obj) {
output.push(something);
}
console.log(output);
What is the output of line 11?
let obj = {
foo: 1,
bar: 2
};
let output = [];
for (let something in obj) {
output.push(something);
}
console.log(output);
What is the output of line 11?
Correct Answer: B
Vote an answer
Explanation: Only visible for FreeCram members. You can sign-up / login (it's free).
function myFunction() {
a = a + b;
var b = 1;
}
myFunction();
console.log(a);
console.log(b);
Which statement is correct?
a = a + b;
var b = 1;
}
myFunction();
console.log(a);
console.log(b);
Which statement is correct?
Correct Answer: D
Vote an answer
Explanation: Only visible for FreeCram members. You can sign-up / login (it's free).
A developer wants to catch any error that countSheep() may throw and pass it to handleError().
Which implementation is correct?
Which implementation is correct?
Correct Answer: D
Vote an answer
Explanation: Only visible for FreeCram members. You can sign-up / login (it's free).
Refer to the code:
01 let car1 = new Promise((_, reject) =>
02 setTimeout(reject, 2000, "Car 1 crashed in"));
03 let car2 = new Promise(resolve =>
04 setTimeout(resolve, 1500, "Car 2 completed"));
05 let car3 = new Promise(resolve =>
06 setTimeout(resolve, 3000, "Car 3 completed"));
07
08 Promise.race([car1, car2, car3])
09 .then(value => {
10 let result = '$(value) the race.';
11 })
12 .catch(err => {
13 console.log("Race is cancelled.", err);
14 });
What is the value of result when Promise.race executes?
01 let car1 = new Promise((_, reject) =>
02 setTimeout(reject, 2000, "Car 1 crashed in"));
03 let car2 = new Promise(resolve =>
04 setTimeout(resolve, 1500, "Car 2 completed"));
05 let car3 = new Promise(resolve =>
06 setTimeout(resolve, 3000, "Car 3 completed"));
07
08 Promise.race([car1, car2, car3])
09 .then(value => {
10 let result = '$(value) the race.';
11 })
12 .catch(err => {
13 console.log("Race is cancelled.", err);
14 });
What is the value of result when Promise.race executes?
Correct Answer: B
Vote an answer
Explanation: Only visible for FreeCram members. You can sign-up / login (it's free).
Given the code below:
01 setTimeout(() => {
02 console.log(1);
03 }, 1100);
04 console.log(2);
05 new Promise((resolve, reject) => {
06 setTimeout(() => {
07 reject(console.log(3));
08 }, 1000);
09 }).catch(() => {
10 console.log(4);
11 });
12 console.log(5);
What is logged to the console?
01 setTimeout(() => {
02 console.log(1);
03 }, 1100);
04 console.log(2);
05 new Promise((resolve, reject) => {
06 setTimeout(() => {
07 reject(console.log(3));
08 }, 1000);
09 }).catch(() => {
10 console.log(4);
11 });
12 console.log(5);
What is logged to the console?
Correct Answer: D
Vote an answer
Explanation: Only visible for FreeCram members. You can sign-up / login (it's free).
Refer to the following code:
01 let obj = {
02 foo: 1,
03 bar: 2
04 }
05 let output = []
06
07 for (let something of obj) {
08 output.push(something);
09 }
10
11 console.log(output);
What is the value of output on line 11?
01 let obj = {
02 foo: 1,
03 bar: 2
04 }
05 let output = []
06
07 for (let something of obj) {
08 output.push(something);
09 }
10
11 console.log(output);
What is the value of output on line 11?
Correct Answer: D
Vote an answer
Explanation: Only visible for FreeCram members. You can sign-up / login (it's free).
A developer wants to advocate for a mature, well-supported web framework/library instead of a new one (Minimalist.js).
Which two should be recommended?
Which two should be recommended?
Correct Answer: B,C
Vote an answer
Explanation: Only visible for FreeCram members. You can sign-up / login (it's free).
A developer implements a function that adds a few values.
function sum(num1, num2, num3) {
if (num3 === undefined) {
num3 = 0;
}
return num1 + num2 + num3;
}
Which three options can the developer invoke for this function to get a return value of 10?
function sum(num1, num2, num3) {
if (num3 === undefined) {
num3 = 0;
}
return num1 + num2 + num3;
}
Which three options can the developer invoke for this function to get a return value of 10?
Correct Answer: A,B,C
Vote an answer
Explanation: Only visible for FreeCram members. You can sign-up / login (it's free).
01 function Animal(size, type) {
02 this.type = type || 'Animal';
03 this.canTalk = false;
04 }
05
06 Animal.prototype.speak = function() {
07 if (this.canTalk) {
08 console.log("It spoke!");
09 }
10 };
11
12 let Pet = function(size, type, name, owner) {
13 Animal.call(this, size, type);
14 this.size = size;
15 this.name = name;
16 this.owner = owner;
17 }
18
19 Pet.prototype = Object.create(Animal.prototype);
20 let pet1 = new Pet();
Given the code above, which three properties are set for pet1?
02 this.type = type || 'Animal';
03 this.canTalk = false;
04 }
05
06 Animal.prototype.speak = function() {
07 if (this.canTalk) {
08 console.log("It spoke!");
09 }
10 };
11
12 let Pet = function(size, type, name, owner) {
13 Animal.call(this, size, type);
14 this.size = size;
15 this.name = name;
16 this.owner = owner;
17 }
18
19 Pet.prototype = Object.create(Animal.prototype);
20 let pet1 = new Pet();
Given the code above, which three properties are set for pet1?
Correct Answer: B,D,E
Vote an answer
Explanation: Only visible for FreeCram members. You can sign-up / login (it's free).