JavaScript-Developer-I Braindumps Real Exam Updated on Oct 12, 2026 with 149 Questions
Latest JavaScript-Developer-I PDF Dumps & Real Tests Free Updated Today
NEW QUESTION # 69
Refer to the code below:
Let car1 = new Promise((_ , reject) =>
setTimeout(reject, 2000, "car 1 crashed in" =>
Let car2 =new Promise(resolve => setTimeout(resolve, 1500, "car 2 completed") Let car3 =new Promise(resolve => setTimeout(resolve, 3000, "car 3 completed") Promise.race(( car1, car2, car3))
.then (value => (
Let result = '$(value) the race.';)}
.catch(arr => {
console.log("Race is cancelled.", err);
});
What is the value of result when Promise.race executes?
- A. Car 1 crashed in the race.
- B. Car 2 completed the race.
- C. Race is cancelled.
- D. Car 3 completes the race
Answer: B
NEW QUESTION # 70
A developer has a web server running with Node.js. The command to start the web server is node server.js.
The web server started having
latency issues. Instead of a one second turnaround for web requests, the developer now sees a five second turnaround.
Which command can the web developer run to see what the module is doing during the latency period?
- A. NODE_DEBUG=http,https node server.js
- B. DEBUG=http, https node server.js
- C. NODE_DEBUG=true node server.js
- D. DEBUG=true node server.js
Answer: D
NEW QUESTION # 71
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 number in the array, The test passes:
Let res = sum2([1, 2, 3 ]) ;
console.assert(res === 6 );
Res = sum3([ 1, 2, 3, 4]);
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. The test passes:
Which two results occur when running the test on the updated sum3 function ?
Choose 2 answers
- A. The line 02 assertion fails
- B. The line 05 assertion fails.
- C. The line 02 assertion passes.
- D. The line 05 assertion passes.
Answer: B,C
NEW QUESTION # 72
Refer to the following object:
const dog = {
firstName: ' Beau ' ,
lastName: ' Boo ' ,
get fullName() {
return this.firstName + ' ' + this.lastName;
}
};
How can a developer access the fullName property for dog?
- A. dog.function.fullName()
- B. dog.fullName
- C. dog.fullName()
- D. dog.get.fullName
Answer: B
Explanation:
The correct answer is A .
This object uses a getter :
get fullName() {
return this.firstName + ' ' + this.lastName;
}
A getter looks like a method when it is defined, but it is accessed like a normal property.
So the correct access syntax is:
dog.fullName
That returns:
" Beau Boo "
The important distinction is:
dog.fullName
not:
dog.fullName()
Because fullName is a getter property, not a regular function property.
Option B is incorrect because calling dog.fullName() tries to call the returned string as a function. Since " Beau Boo " is not a function, that would cause a TypeError.
Option C is incorrect because there is no get object inside dog.
Option D is incorrect because there is no function object inside dog, and getters are not accessed that way.
Therefore, the verified answer is A .
NEW QUESTION # 73
Refer to the code:
Given the code above, which three properties are set pet1?
Choose 3 answers:
- A. Type
- B. Size
- C. Name
- D. Owner
- E. canTalk
Answer: A,B,E
NEW QUESTION # 74
What is the result of the code block?
- A. An error is thrown.
- B. The console logs 'flag' and then an error is thrown.
- C. The console logs only 'flag'.
- D. The console logs 'flag' and another flag.
Answer: C
NEW QUESTION # 75
Refer to the following array:
Let arr = [1, 2, 3, 4, 5];
Which three options result in x evaluating as [1,2]?
Choose 3 answer
- A. let x = arr.filter ((a) => 2 }) ;
- B. let x = arr.slice (2);
- C. let x = arr. slice (0, 2);
- D. let x arr.filter((a) => (return a <= 2 });
- E. let x =arr.splice(0, 2);
Answer: C,D,E
NEW QUESTION # 76
A developer has a server running with Node.js. the command to start the web server is node server.js. the server started having latency issues. Instead of a one second turnaround for web requests, the developer now sees a five second turnaround.
Which command can the web developer run to see what the module is doing during the latency period?
- A. NODE_DEBUO=http, https node server,js
- B. DEBUO=http, https node server,js
- C. DEBUO=true node server,js
- D. NODE_DEBUO=true node server,js
Answer: B
NEW QUESTION # 77
Refer to the code below:
What value can a developer expect when referencing o,js,secondCity?
- A. 'new york'
- B. 'New York
- C. Undefined
- D. An error
Answer: A
NEW QUESTION # 78
A developer executes:
document.cookie;
document.cookie = ' key=John Smith ' ;
What is the behavior?
- A. Cookies are not read because line 01 should be document.cookies, but the key value is set and all cookies are wiped.
- B. Cookies are read and the key value is set, the remaining cookies are unaffected.
- C. Cookies are read, but the key value is not set because the value is not URL encoded.
- D. Cookies are read and the key value is set, and all cookies are wiped.
Answer: B
Explanation:
* document.cookie retrieves the cookie string.
* Setting document.cookie = ' key=John Smith ' adds or updates only that one cookie.
Important details:
* Writing to document.cookie does not overwrite all cookies .
* The browser does not require URL encoding , though it is recommended. Non-encoded spaces are allowed and automatically handled.
* document.cookies does not exist; the correct property is document.cookie.
Therefore, the correct behavior:
* Cookies are read.
* A new cookie key=John Smith is set.
* Existing cookies remain.
JavaScript Knowledge References (text-only)
* Writing document.cookie appends or updates cookies, not replaces them.
* document.cookie is both getter and setter for cookie strings.
NEW QUESTION # 79
Code:
01 const sayHello = (name) = > {
02 console.log( ' Hello ' , name);
03 };
04
05 const world = () = > {
06 return ' World ' ;
07 };
08
09 sayHello(world);
This does not print " Hello World " .
What change is needed?
- A. Change line 9 to sayHello(world)();
- B. Change line 7 to }();
- C. Change line 5 to function world() {
- D. Change line 2 to console.log( ' Hello ' , name());
Answer: D
Explanation:
Currently:
* sayHello expects a value name and prints it.
* world is a function that returns ' World ' .
* sayHello(world); passes the function object itself, not the result of calling it.
So name inside sayHello is a function, not the string " World " .
To keep the call sayHello(world) yet get " World " , sayHello must call the function parameter:
const sayHello = (name) = > {
console.log( ' Hello ' , name());
};
Now:
* sayHello(world) passes the function.
* Inside sayHello, name() calls world(), which returns " World " .
* The console logs " Hello World " .
Why the others are wrong:
* B: Changing line 7 to }(); would attempt to IIFE the function definition and break the declaration.
* C: sayHello(world)() would try to call the return value of sayHello, which is undefined, causing an error.
* D: Changing world to a function declaration does not change the fact that it is passed as a function reference; sayHello still prints the function object, not ' World ' .
NEW QUESTION # 80
Refer to the following code that performs a basic mathematical operation on a provided input:
function calculate(num) {
Return (num +10) / 3;
}
How should line 02 be written to ensure that x evaluates to 6 in the line below?
Let x = calculate (8);
- A. Return (Number (num +10 ) / 3;
- B. Return Number(num + 10) / 3;
- C. Return Integer(num +10) /3;
- D. Return Number((num +10) /3 );
Answer: A
NEW QUESTION # 81
Refer to code below:
console.log(0);
setTimeout(() => (
console.log(1);
});
console.log(2);
setTimeout(() => {
console.log(3);
), 0);
console.log(4);
In which sequence will the numbers be logged?
- A. 0
- B. 02413
- C. 02431
- D. 01234
Answer: B
NEW QUESTION # 82
Refer to the code below (corrected to use a template literal on line 08):
01 let car1 = new Promise((_, reject) = >
02 setTimeout(reject, 2000, " Car 1 crashed in " )
03 );
04 let car2 = new Promise(resolve = >
05 setTimeout(resolve, 1500, " Car 2 completed " )
06 );
07 let car3 = new Promise(resolve = >
08 setTimeout(resolve, 3000, " Car 3 completed " )
09 );
10
11 Promise.race([car1, car2, car3])
12 .then(value = > {
13 let result = `${value} the race.`;
14 })
15 .catch(err = > {
16 console.log( " Race is cancelled. " , err);
17 });
What is the value of result when Promise.race executes?
- A. Car 3 completed the race.
- B. Car 1 crashed in the race.
- C. Car 2 completed the race.
- D. Race is cancelled.
Answer: C
Explanation:
Understand the three promises:
* car1:
let car1 = new Promise((_, reject) = >
setTimeout(reject, 2000, " Car 1 crashed in " )
);
* Rejects after 2000 ms (2 seconds) with message " Car 1 crashed in " .
* car2:
let car2 = new Promise(resolve = >
setTimeout(resolve, 1500, " Car 2 completed " )
);
* Resolves after 1500 ms (1.5 seconds) with message " Car 2 completed " .
* car3:
let car3 = new Promise(resolve = >
setTimeout(resolve, 3000, " Car 3 completed " )
);
* Resolves after 3000 ms (3 seconds) with message " Car 3 completed " .
Promise.race:
Promise.race([car1, car2, car3])
then(value = > {
let result = `${value} the race.`;
})
catch(err = > {
console.log( " Race is cancelled. " , err);
});
Behavior of Promise.race:
* It settles (resolves or rejects) as soon as any of the given promises settles.
* It uses the value or reason from the first settled promise.
Timing:
* car2 resolves in 1500 ms.
* car1 rejects in 2000 ms.
* car3 resolves in 3000 ms.
The first to settle is car2 at 1500 ms, with value " Car 2 completed " .
Therefore:
* Promise.race resolves (not rejects) with value = " Car 2 completed " .
* The .then handler runs; .catch is ignored because there is no rejection.
Inside .then:
let result = `${value} the race.`;
Substitute value:
let result = " Car 2 completed the race. " ;
So, result becomes:
Car 2 completed the race.
Compare to options:
* A. Car 3 completed the race.
* This would be correct if car3 were the first to resolve, which it is not (it resolves last).
* B. Car 2 completed the race.
* Exactly matches the first-resolving promise and the constructed message.
* C. Race is cancelled.
* This is the prefix of the string logged in the .catch handler, but .catch never runs because the race resolves, it does not reject first.
* D. Car 1 crashed in the race.
* car1 is the first rejection , but since a resolution from car2 happens earlier, the race is already settled successfully before car1 rejects.
Thus the correct value of result as set in the .then block is:
The answer: B
Study Guide / Concept References (no links):
* Promise.race(iterable) semantics (first settled promise wins)
* setTimeout and timing interactions with Promises
* Resolve vs reject paths and .then / .catch
* Template literals and string interpolation for building result messages
NEW QUESTION # 83
Refer to the code below:
<html lang="en">
<tableonclick="console.log(Table log');">
<tr id="row1">
<td>Click me!</td>
</tr>
<table>
<script>
functionprintMessage(event) {
console.log('Row log');
}
Let elem = document.getElementById('row1');
elem.addEventListener('click', printMessage, false);
</script>
</html>
Which code change should be made for the console to log only Row log when 'Click me! ' is clicked?
- A. Add.event.stopPropagation(); to window.onLoad event handler.
- B. Add event.stopPropagation(); to printMessage function.
- C. Add event.removeEventListener(); toprintMessage function.
- D. Addevent.removeEventListener(); to window.onLoad event handler.
Answer: B
NEW QUESTION # 84
Which two console logs out NaN?
Choose 2 answers
- A. Console.log(parseint ('two') ) ;
- B. Console.log (10 / 0);
- C. Console.log(10 / 'five' ') ;
- D. Console.log(10 / Number ('5) );
Answer: A,C
NEW QUESTION # 85
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 format, what should the new package version number be?
- A. 1.1.4
- B. 2.0.0
- C. 1.2.0
- D. 1.2.3
Answer: B
NEW QUESTION # 86
developer creates a new web server that uses Node.js. It imports a server library that uses events and callbacks for handling server functionality.
The server library is imported with require and is made available to the code by a variable named server. The developer wants to log any issues that the server has while booting up.
Given the code and the information the developer has, which code logs an error at boost with an event?
- A. Try{
server.start();
} catch(error) { - B. Server.on ('error', (error) => {
console.log('ERROR', error);
}); - C. Server.error ((server) => {
console.log('ERROR', error);
}); - D. Server.catch ((server) => {
console.log('ERROR', error);
});
Answer: B
Explanation:
console.log('ERROR', error);
}
NEW QUESTION # 87
Given the following code:
Let x =('15' + 10)*2;
What is the value of a?
- A. 0
- B. 1
- C. 2
- D. 3
Answer: B
NEW QUESTION # 88
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?
- A. [1, 2]
- B. [ " foo " , " bar " ]
- C. [ " foo:1 " , " bar:2 " ]
- D. An error will occur due to the incorrect usage of the for_of statement on line 07.
Answer: D
Explanation:
The key line is:
for (let something of obj) {
In JavaScript:
* for...of is used to iterate over iterable objects, such as:
* Arrays
* Strings
* Maps
* Sets
* Other objects that implement a [Symbol.iterator] method.
Plain JavaScript objects created with object literal {} are not iterable by default . They do not have [Symbol.
iterator], so using for...of directly on them causes a runtime error.
Specifically:
for (let something of obj) { ... }
will throw a TypeError similar to:
obj is not iterable
Therefore, the loop body never executes, and console.log(output); is never reached without an error.
Why other options are incorrect:
* B. [1, 2]
* To get [1, 2], you could use Object.values(obj) and iterate that array.
* But here, for...of obj never yields values because it throws an error.
* C. [ " foo " , " bar " ]
* To get property names, you could use Object.keys(obj) with for...of.
* Again, the code does not do that; it incorrectly tries to iterate the object directly.
* D. [ " foo:1 " , " bar:2 " ]
* You would need both keys and values, combining them manually.
* The given code does not implement such logic and fails before pushing anything into output.
Hence, the correct answer is:
The answer: A
Study Guide / Concept References (no links):
* Difference between for...of and for...in
* Iterables in JavaScript and [Symbol.iterator]
* Plain objects {} are not iterable by default
* Correct patterns to iterate object keys/values (Object.keys, Object.values, Object.entries)
NEW QUESTION # 89
A Node.js server library uses events and callbacks. The developer wants to log any issues the server has at boot time.
Which code logs an error with an event?
- A. try {
server.start();
} catch(error) {
console.log( ' ERROR ' , error);
} - B. server.on( ' error ' , (error) = > {
console.log( ' ERROR ' , error);
}); - C. server.error( ' error) = > {
console.log( ' ERROR ' , error);
}); - D. server.catch( ' error) = > {
console.log( ' ERROR ' , error);
});
Answer: B
Explanation:
Node.js event-based modules use the EventEmitter pattern.
The correct syntax for listening to events is:
emitter.on( ' eventName ' , callback)
The server library emits an ' error ' event, which must be listened to using .on.
Option analysis:
* A: .catch is for Promises, not EventEmitters.
* B: .error is not an EventEmitter method.
* C: Correct. Listens to the ' error ' event.
* D: try...catch only captures synchronous errors, not event-based asynchronous errors.
Therefore, the correct answer is option C .
JavaScript Knowledge References (text-only)
* The EventEmitter API uses on(event, handler) to listen for events.
* Errors emitted asynchronously cannot be caught with try...catch.
* The ' error ' event is standard for Node.js modules to signal operational errors.
NEW QUESTION # 90
Given the following code:
What is the output of line 02?
- A. "x-
- B. "undefined" 0
- C. "null"
- D. 'object"
Answer: D
NEW QUESTION # 91
Given two expressions var1 and var2, what are two valid ways to return the logical AND of the two expression and ensure it is data type Boolean? Choose 2 answers
- A. Var1. Toboolean ( ) && var2, to Boolean ( )
- B. Var1 && var2
- C. Boolean (var1) && Boolean (var2)
- D. Boolean (var1 && var2)
Answer: A,D
NEW QUESTION # 92
......
The Salesforce Certified JavaScript Developer (JS-Dev-101) certification exam comprises 60 multiple-choice questions that must be completed in 105 minutes. JavaScript-Developer-I exam is available in both English and Japanese languages, and the passing score is 68%. Candidates who pass the JavaScript-Developer-I Certification Exam will receive a Salesforce Certified JavaScript Developer I credential. Salesforce Certified JavaScript Developer (JS-Dev-101) certification is valid for two years, after which the candidate must pass the exam again to maintain their certification status.
JavaScript-Developer-I Dumps With 100% Verified Q&As - Pass Guarantee or Full Refund: https://www.lead2passexam.com/Salesforce/valid-JavaScript-Developer-I-exam-dumps.html
Pass Salesforce JavaScript-Developer-I Exam With Practice Test Questions Dumps Bundle: https://drive.google.com/open?id=1QVHjU5M_zAKEF9c8jcdfvdzWUI4BAXJZ