Salesforce Certified JavaScript Developer (JS-Dev-101) - JavaScript-Developer-I Exam Practice Test

function myFunction() {
a = a + b;
var b = 1;
}
myFunction();
console.log(a);
console.log(b);
Which statement is correct?
Correct Answer: C Vote an answer
Explanation: Only visible for PassTestking members. You can sign-up / login (it's free).
A page loads 50+ < div class= " ad-library-item " > elements, all ads.
Developer wants to quickly and temporarily remove them.
Options:
Correct Answer: A Vote an answer
Explanation: Only visible for PassTestking members. You can sign-up / login (it's free).
Original constructor function:
01 function Vehicle(name, price) {
02 this.name = name;
03 this.price = price;
04 }
05 Vehicle.prototype.priceInfo = function () {
06 return `Cost of the $(this.name) is $(this.price)$`;
07 }
08 var ford = new Vehicle( ' Ford Fiesta ' , ' 20,000 ' );
Which class definition is correct?
Correct Answer: B Vote an answer
Explanation: Only visible for PassTestking members. You can sign-up / login (it's free).
Given a value, which two options can a developer use to detect if the value is NaN?
Correct Answer: B,D Vote an answer
Explanation: Only visible for PassTestking members. You can sign-up / login (it's free).
A developer wrote the following code to test a sum3 function that takes in an array of numbers and returns the sum of the first three numbers in the array. The test passes:
01 let res = sum3([1, 2, 3]);
02 console.assert(res === 6);
03
04 res = sum3([1, 2, 3, 4]);
05 console.assert(res === 6);
A different developer made changes to the behavior of sum3 to instead sum all of the numbers present in the array.
Which two results occur when running the test on the updated sum3 function?
Correct Answer: B,D Vote an answer
Explanation: Only visible for PassTestking members. You can sign-up / login (it's free).
A class was written to represent regular items and sale items. Code:
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; }
08 console.log(regItem.description());
09 console.log(saleItem.description());
What is the output?
Correct Answer: A Vote an answer
Explanation: Only visible for PassTestking members. You can sign-up / login (it's free).
Given the code:
01 function GameConsole(name) {
02 this.name = name;
03 }
04
05 GameConsole.prototype.load = function(gamename) {
06 console.log( ' ${this.name} is loading a game: ${gamename}.... ' );
07 }
08
09 function Console16bit(name) {
10 GameConsole.call(this, name);
11 }
12
13 Console16bit.prototype = Object.create(GameConsole.prototype);
14
15 // insert code here
16 console.log( ' ${this.name} is loading a cartridge game: ${gamename}.... ' );
17 }
18
19 const console16bit = new Console16bit( ' SNEGeneziz ' );
20 console16bit.load( ' Super Monic 3x Force ' );
What should a developer insert at line 15?
Correct Answer: D Vote an answer
Explanation: Only visible for PassTestking members. You can sign-up / login (it's free).
Original code:
01 let requestPromise = client.getRequest;
03 requestPromise().then((response) = > {
04 handleResponse(response);
05 });
The developer wants to gracefully handle errors from a Promise-based GET request.
Which code modification is correct?
Correct Answer: B Vote an answer
Explanation: Only visible for PassTestking members. You can sign-up / login (it's free).
Which actions can be done using the JavaScript browser console?
Correct Answer: D Vote an answer
Explanation: Only visible for PassTestking members. You can sign-up / login (it's free).
01 function changeValue(obj) {
02 obj.value = obj.value / 2;
03 }
04 const objA = { value: 10 };
05 const objB = objA;
06
07 changeValue(objB);
08 const result = objA.value;
What is the value of result?
Correct Answer: B Vote an answer
Explanation: Only visible for PassTestking members. You can sign-up / login (it's free).