[Q70-Q90] Full JS-Dev-101 Practice Test and 149 Unique Questions, Get it Now!

Share

Full JS-Dev-101 Practice Test and 149 Unique Questions, Get it Now!

The Best JS-Dev-101 Exam Study Material Premium Files  and Preparation Tool

NEW QUESTION # 70
A page loads 50+ <div class="ad-library-item"> elements, all ads.
Developer wants to quickly and temporarily remove them.
Options:

  • A. Use the browser console to execute a script that prevents the load event from firing.
  • B. Use the browser console to execute a script that removes all elements containing the class ad-library-item.
  • C. Use the DOM inspector to remove all elements containing the class ad-library-item.
  • D. Use the DOM inspector to prevent the load event from firing.

Answer: B

Explanation:
________________________________________
Comprehensive and Detailed Explanation From Exact Extract JavaScript Knowledge The goal:
"Temporarily and quickly remove them."
The fastest way is to run a script in the browser console that removes all such elements:
document.querySelectorAll('.ad-library-item').forEach(el => el.remove()); This immediately removes all 50+ elements and requires no page reload.
Option analysis:
A & B: Preventing load events is unreliable and does not remove already-created DOM nodes.
C: Correct-console code can remove all matching DOM elements instantly.
D: Possible but extremely slow; removing 50+ elements one by one in the inspector is not "quick." Therefore, C is the best answer.
________________________________________
JavaScript Knowledge Reference (text-only)
The browser console can run arbitrary JavaScript that manipulates the DOM.
document.querySelectorAll() returns all matching DOM nodes.
Nodes can be removed using .remove().


NEW QUESTION # 71
Refer to the code declarations below:
Which three expressions return the string JavaScript?
Choose 3 answers

  • A. Str1.concat (str2);
  • B. Str1.join (str2);
  • C. Concat (str1, str2);
  • D. $(str1) $ (str2} ';
  • E. Str1 + str2;

Answer: A,D,E


NEW QUESTION # 72
A developer writers the code below to calculate the factorial of a given number.
Function factorial(number) {
Return number + factorial(number -1);
}
factorial(3);
What is the resultof executing line 04?

  • A. 0
  • B. -Infinity
  • C. 1
  • D. RuntimeError

Answer: D


NEW QUESTION # 73
A developer is trying to convince management that their team will benefit from using Node.js for a backend server that they are going to create. The server will be a web server that handles API requests from a website that the team has already built using HTML, CSS, and JavaScript.
Which three benefits of Node.js can the developer use to persuade their manager?
Choose 3 answers

  • A. Uses non-blocking functionality for performant request handling.
  • B. Executes server-side JavaScript code to avoid learning a new language.
  • C. Installs with its own package manager to install and manage third-party libraries.
  • D. Performs a static analysis on code before execution to look for runtime errors.
  • E. Ensures stability with one major release every few years.

Answer: A,B,C


NEW QUESTION # 74
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. slice (0, 2);
  • B. let x = arr.filter ((a) => 2 }) ;
  • C. let x =arr.splice(0, 2);
  • D. let x arr.filter((a) => (return a <= 2 });
  • E. let x = arr. slice (2);

Answer: A,C,D


NEW QUESTION # 75
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?

  • A. 1 growl method is created for Option A. 1000 growl methods are created for Option B.
  • B. 1 growl method is created regardless of which option is used.
  • C. 1000 growl methods are created for Option A. 1 growl method is created for Option B.
  • D. 1000 growl methods are created regardless of which option is used.

Answer: C

Explanation:
Option A:
this.growl = () => { ... } inside the constructor creates a new function per instance.
For 1000 new Monster(), you get 1000 distinct growl functions, each stored on the instance itself.
Option B:
Monster.prototype.growl = () => { ... } attaches growl to the prototype.
All instances share the same single growl function via the prototype chain.
For 1000 instances, only 1 growl method exists in memory.
So: Option A → 1000; Option B → 1.
________________________________________


NEW QUESTION # 76
Given the HTML below:

Which statement adds the priority-account css class to the Applied Shipping row?

Answer:

Explanation:
document.querySelector('#row-as').classList.add('priority-account');


NEW QUESTION # 77
A developer is asked to fix some bugs reported by users. To do that, the developer adds abreakpoint for debugging.
Function Car (maxSpeed, color){
This.maxspeed =masSpeed;
This.color = color;
Let carSpeed = document.getElementById(' CarSpeed');
Debugger;
Let fourWheels =new Car (carSpeed.value, 'red');
When the code execution stops at the breakpoint on line 06, which two types of information are available in the browser console ?
Choose 2 answers:

  • A. The information stored in the window.localStorage property
  • B. A variable displaying the number of instances created for the Car Object.
  • C. The style, event listeners and other attributes applied to the carSpeed DOM element
  • D. The values of the carSpeed and fourWheels variables

Answer: A,C


NEW QUESTION # 78
Which three statements are true about promises ?
Choose 3 answers

  • A. A Promise has a .then() method.
  • B. A pending promise canbecome fulfilled, settled, or rejected.
  • C. A fulfilled or rejected promise will not change states .
  • D. The executor of a new Promise runs automatically.
  • E. A settled promise can become resolved.

Answer: A,B,C


NEW QUESTION # 79
Which two implementations of utils.js support foo and bar?

  • A. const foo = () => { return 'foo'; }
    const bar = () => { return 'bar'; }
    export default {foo, bar};
  • B. const foo = () => { return 'foo'; }
    const bar = () => { return 'bar'; }
    export {foo, bar};
  • C. import {foo} from "./helpers/utils.js";
    export {foo, bar};
  • D. export default class {
    foo() { return 'foo'; }
    bar() { return 'bar'; }

Answer: B,D

Explanation:
}


NEW QUESTION # 80
Given two expressions var1 and var2, what are two valid ways to return the concatenation of the two expressions and ensure it is data type string?

  • A. var1 + var2
  • B. var1.toString() + var2.toString()
  • C. String(var1).concat(var2)
  • D. String.concat(var1 + var2)

Answer: B,C

Explanation:
Comprehensive and Detailed Explanation From JavaScript Knowledge:
We want to guarantee that the result is of type string regardless of what var1 and var2 are (numbers, booleans, etc.).
Option A:
String(var1).concat(var2)
String(var1) converts var1 explicitly to a string.
.concat(var2) calls String.prototype.concat, which:
Converts var2 to string if needed.
Returns a new string that is the concatenation of the two.
Result is always a string.
So A is valid.
Option B:
String.concat(var1 + var2)
String.concat (as a static method) does not exist. concat is an instance method on string objects, not on the String constructor.
var1 + var2 might be a number (if both numeric) and used incorrectly here.
So B is invalid.
Option C:
var1 + var2
+ can mean:
String concatenation (if at least one operand is a string).
Numeric addition (if both operands are numbers).
If var1 and var2 are both numbers, var1 + var2 will be a number, not a string.
This does not ensure the result is always a string.
So C is not guaranteed to satisfy the requirement.
Option D:
var1.toString() + var2.toString()
var1.toString() converts var1 to a string (for most primitive/object types).
var2.toString() does the same.
Now both operands of + are strings, so the result is string concatenation.
Result is guaranteed to be a string.
So D is valid.
Therefore, the two valid ways are A and D.
Study Guide / Concept Reference (no links):
String() conversion vs .toString()
String.prototype.concat
+ operator overload: numeric addition vs string concatenation
Type coercion rules for primitives
________________________________________


NEW QUESTION # 81
Refer to the code:
01 const event = new CustomEvent(
02 // Missing code
03 );
04 obj.dispatchEvent(event);
A developer needs to dispatch a custom event called update to send information about recordId.
Which two options can be inserted at line 02?

  • A. 'update', '123abc'
  • B. 'update', { detail: { recordId: '123abc' } }
  • C. 'update', { recordId: '123abc' }
  • D. { type: 'update', recordId: '123abc' }

Answer: B,C

Explanation:
________________________________________
Comprehensive and Detailed Explanation From Exact Extract JavaScript Knowledge The correct constructor signature for CustomEvent is:
new CustomEvent(eventName, optionsObject)
Where:
eventName is a string.
optionsObject may include:
detail → used to pass custom data
bubbles
cancelable, etc.
Example:
new CustomEvent('update', {
detail: { recordId: '123abc' }
});
Now evaluate each option:
________________________________________
Option A
{ type: 'update', recordId: '123abc' }
Incorrect: The constructor requires (eventName, options), not a single object. type is not used this way.
________________________________________
Option B
'update', { detail: { recordId: '123abc' } }
Correct format. detail is the proper place for custom event data.
________________________________________
Option C
'update', '123abc'
Incorrect: The second argument must be an object (options), not a string.
________________________________________
Option D
'update', { recordId: '123abc' }
Acceptable because any extra properties on the options object are still allowed, even though best practice is to use detail.
This still creates a valid CustomEvent, and the event will dispatch successfully.
Thus the two correct answers are B and D.
________________________________________
JavaScript Knowledge Reference (text-only)
new CustomEvent(name, options) is the required syntax.
The detail property of the options object is the standard location for custom data.
The second argument must be an object; other types are invalid.


NEW QUESTION # 82
Refer to the code below:
01 let total = 10;
02 const interval = setInterval(() => {
03 total++;
04 clearInterval(interval);
05 total++;
06 }, 0);
07 total++;
08 console.log(total);
Considering that JavaScript is single-threaded, what is the output of line 08 after the code executes?

  • A. 0
  • B. 1
  • C. 2
  • D. 3

Answer: A

Explanation:
Comprehensive and Detailed Explanation From Exact Extract JavaScript knowledge:
Synchronous execution order
JavaScript executes code in a single thread, following a well-defined order:
All synchronous code runs first, line by line.
Asynchronous callbacks (like those scheduled with setInterval or setTimeout) are placed into the event queue and executed only after the current call stack is empty.
Let's follow the code step by step:
Line 01:
let total = 10;
total is initialized with the value 10.
Line 02:
const interval = setInterval(() => {
total++;
clearInterval(interval);
total++;
}, 0);
setInterval schedules the callback function to run repeatedly after a delay of at least 0 milliseconds, but it does not run immediately. The callback is added to the timer queue and will be invoked after the current synchronous script finishes and the event loop gets to process timer callbacks.
At this point, interval holds the interval ID, but the callback has not executed yet.
Line 07:
total++;
This is still synchronous, so it runs before any scheduled callbacks.
total was 10, now it becomes 11.
Line 08:
console.log(total);
At this moment, the interval callback has still not run (because the event loop has not yet processed the timer queue).
So total is 11, and console.log(total); outputs 11.
Therefore, the value printed at line 08 is 11, making option A correct.
What happens after the log (for understanding, not affecting the answer) After the main script finishes, the event loop processes the timer callback for setInterval:
Callback:
() => {
total++; // from 11 to 12
clearInterval(interval); // cancels further executions
total++; // from 12 to 13
}
So eventually total becomes 13, but this happens after console.log(total) has already executed. Since the question asks specifically for the output at line 08, the asynchronous updates do not change that line's output.
Why other options are incorrect
Option B (12): This would require the callback to run before the log, which does not happen because asynchronous callbacks are queued and executed after the current stack finishes.
Option C (10): Ignores the total++ on line 07.
Option D (13): This is the final value after the callback finishes, but it occurs after the console.log line executes, not at the time line 08 runs.
JavaScript knowledge references (descriptive, no links):
JavaScript is single-threaded and uses an event loop with a call stack and task queues.
setInterval schedules callbacks to run asynchronously after a minimum delay; the callback never runs before the current synchronous code finishes.
Synchronous statements like total++ on line 07 execute before any queued interval callback.


NEW QUESTION # 83
A developer has the function, shown below, that is called when a page loads.
function onload() {
console.log("Page has loaded!");
}
Where can the developer see the log statement after loading the page in the browser?

  • A. Terminal running the web server.
  • B. Browser performance toots
  • C. Browser javaScript console
  • D. On the webpage.

Answer: C


NEW QUESTION # 84
Refer to following code block:
Let array = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11,];
Let output =0;
For (let num of array){
if (output >0){
Break;
}
if(num % 2 == 0){
Continue;
}
Output +=num;
What is the value of output after the code executes?

  • A. 0
  • B. 1
  • C. 2
  • D. 3

Answer: B


NEW QUESTION # 85
Refer to the code below:
Let inArray =[ [ 1, 2 ] , [ 3, 4, 5 ] ];
Which two statements result in the array [1, 2, 3, 4, 5] ?
Choose 2 answers

  • A. [ ]. Concat.apply ([ ], inArray);
  • B. [ ]. concat.apply(inArray, [ ]);
  • C. []. Concat (... inArray);
  • D. [ ]. concat ( [ ....inArray ] );

Answer: A,C


NEW QUESTION # 86
Refer to the code below:
<html lang="en">
<table onclick="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 printMessage function.
  • B. Add.event.stopPropagation(); to window.onLoad event handler.
  • C. Add event.removeEventListener(); to window.onLoad event handler.
  • D. Add event.removeEventListener(); toprintMessage function.

Answer: A


NEW QUESTION # 87
A developer wants to define a function log to be used a few times on a single-file JavaScript script.
01 // Line 1 replacement
02 console.log('"LOG:', logInput);
03 }
Which two options can correctly replaceline 01 and declare the function for use?
Choose 2 answers

  • A. const log = (logInput) => {
  • B. const log(loginInput) {
  • C. function log = (logInput) {
  • D. function leg(logInput) {

Answer: A,D


NEW QUESTION # 88
Refer to the code:

Given the code above, which three properties are set pet1? Choose 3 answers:

  • A. Type
  • B. Name
  • C. canTalk
  • D. Owner
  • E. Size

Answer: A,C,E


NEW QUESTION # 89
Refer to code below:
Let productSKU = '8675309' ;
A developer has a requirement to generate SKU numbers that are always 19 characters lon, starting with 'sku', and padded with zeros.
Which statement assigns the values sku0000000008675309 ?

  • A. productSKU = productSKU .padStart (19. '0').padstart('sku');
  • B. productSKU = productSKU .padEnd (16. '0').padstart(19, 'sku');
  • C. productSKU = productSKU .padStart (16. '0').padstart(19, 'sku');
  • D. productSKU = productSKU .padEnd (16. '0').padstart('sku');

Answer: C


NEW QUESTION # 90
......


Salesforce JS-Dev-101 Exam Syllabus Topics:

TopicDetails
Topic 1
  • Variables, Types, and Collections: Covers declaring and initializing variables, working with strings, numbers, dates, arrays, and JSON, along with understanding type coercion and truthy
  • falsy evaluations.
Topic 2
  • Testing: Covers evaluating unit test effectiveness against a block of code and modifying tests to improve their coverage and reliability.
Topic 3
  • Objects, Functions, and Classes: Covers function, object, and class implementations to meet business requirements, along with the use of modules, decorators, variable scope, and execution flow.
Topic 4
  • Asynchronous Programming: Covers asynchronous programming concepts and understanding how the event loop controls execution flow and determines outcomes.
Topic 5
  • Server Side JavaScript: Covers Node.js implementations, CLI commands, core modules, and package management solutions for given scenarios.
Topic 6
  • Browser and Events: Covers DOM manipulation, event handling and propagation, browser-specific APIs, and using Browser Developer Tools to inspect code behavior.

 

Get Instant Access to JS-Dev-101 Practice Exam Questions: https://www.itcertmagic.com/Salesforce/real-JS-Dev-101-exam-prep-dumps.html

Reliable Study Materials & Testing Engine for JS-Dev-101 Exam Success!: https://drive.google.com/open?id=1g8MShmpZ7vlJPX5Q0F3WcF4jWv4v083s