Get 2025 Updated Free Salesforce JavaScript-Developer-I Exam Questions & Answer [Q83-Q108]

Share

Get 2025 Updated Free Salesforce JavaScript-Developer-I Exam Questions and Answer

JavaScript-Developer-I Dumps PDF and Test Engine Exam Questions


Salesforce JavaScript-Developer-I exam focuses on testing a developer's knowledge of JavaScript and how it can be used to build custom applications on the Salesforce platform. This includes topics such as data modeling, user interface development, and integration with other systems. JavaScript-Developer-I exam is designed to be challenging, but it is also highly respected in the industry and can help developers stand out from the competition.

 

NEW QUESTION # 83
developer uses the code below to format a date.

After executing, what is the value of formattedDate?

  • A. May 10, 2020
  • B. October 05, 2020
  • C. June 10, 2020
  • D. November 05, 2020

Answer: C


NEW QUESTION # 84
A developer wrote a fizzbuzz function that when passed in a number, returns the
following:
● 'Fizz' if the number is divisible by 3.
● 'Buzz' if the number is divisible by 5.
● 'Fizzbuzz' if the number is divisible by both 3 and 5.
● Empty string if the number is divisible by neither 3 or 5.
Which two test cases will properly test scenarios for the fizzbuzz function?
Choose 2 answers

  • A. let res = fizzbuzz(Infinity);
    console.assert ( res === ' ' )
  • B. let res = fizzbuzz(5);
    console.assert ( res === ' ' );
  • C. let res = fizzbuzz(3);
    console.assert ( res === ' buzz ' )
  • D. let res = fizzbuzz(15);
    console.assert ( res === ' fizzbuzz ' )

Answer: A,C,D


NEW QUESTION # 85
Universal Containers recently launched its new landing page to host a crowd-funding
campaign. The page uses an external library to display some third-party ads. Once the page is
fully loaded, it creates more than 50 new HTML items placed randomly inside the DOM, like the
one in the code below:

All the elements includes the same ad-library-item class, They are hidden by default, and they are randomly displayed while the user navigates through the page.

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

Answer: D


NEW QUESTION # 86
Universal Containers recently launched its new landing page to host a crowd-funding campaign. The page uses an external library to display some third-party ads. Once the page is fully loaded, it creates more than 50 new HTML items placed randomly inside the DOM, like the one in the code below:

All the elements includes the same ad-library-item class, They are hidden by default, and they are randomly displayed while the user navigates through the page.

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

Answer: D


NEW QUESTION # 87
Refer to the following array:
Let arr1 = [ 1,2, 3, 4, 5 ];

Which two lines of code result in a second array, arr2 being created such that arr2 is not a reference to arr1?

  • A. Let arr2 = arr1.sort();
  • B. Let arr2 = arr1.slice(0, 5);
  • C. Let arr2 = Array.from(arr1);
  • D. Let arr2 = arr1;

Answer: B,C


NEW QUESTION # 88
Given the HTML below:

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

  • A. document.querySelector('#row-as').classList.add('priority-account');

Answer: A


NEW QUESTION # 89
Which statement can a developer apply to increment the browser's navigation history without a page refresh?

  • A. window.history.pushState(newStateObject);
  • B. window.history.state.push(newStateObject);
  • C. window.history.pushStare(newStateObject, ' ', null);
  • D. window.history.replaceState(newStateObject,'', null);

Answer: D


NEW QUESTION # 90
Given the code below:
01 function GameConsole (name) {
02 this.name = name;
03 }
04
05GameConsole.prototype.load = function(gamename) {
06 console.log( ` $(this.name) is loading agame : $(gamename) ...`);
07 )
08 function Console 16 Bit (name) {
09 GameConsole.call(this, name) ;
10 }
11 Console16bit.prototype = Object.create ( GameConsole.prototype) ;
12 //insert code here
13 console.log( ` $(this.name) is loading a cartridge game :$(gamename) ...`);
14 }
15 const console16bit = new Console16bit(' SNEGeneziz ');
16 console16bit.load(' Super Nonic 3x Force ');
What should a developer insert at line 15 to output the following message using the method ?
> SNEGeneziz is loading a cartridgegame: Super Monic 3x Force . . .

  • A. Console16bit.prototype.load = function(gamename) {
  • B. Console16bit.prototype.load(gamename) = function() {
  • C. Console16bit =Object.create(GameConsole.prototype).load = function(gamename) {
  • D. Console16bit.prototype.load(gamename) {

Answer: A


NEW QUESTION # 91
A developer has code that calculates a restaurant bill, but generates incorrect answers while testing the code:
function calculateBill (items ){
let total = 0;
total += findSubTotal(items);
total += addTax(total);
total += addTip(total);
return total;
}
Which option allows the developer to step into each function execution within calculateBill?

  • A. Calling the console.trace (total) method on line 03.
  • B. Usingthe debugger command on line 03
  • C. Wrapping findSubtotal in a console.log() method.
  • D. Using the debugger command on line 05.

Answer: D


NEW QUESTION # 92
In which situation should a developer include a try... catch block around their function call?

  • A. The function contains scheduled code.
  • B. The function results in an out of memory issue.
  • C. The function has an error that should not be silenced.
  • D. The function might raise a runtime error that needs to be handled.

Answer: D


NEW QUESTION # 93
A 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 boot time with an event?
A)

B)

C)

D)

  • A. Option B
  • B. Option D
  • C. Option C
  • D. Option A

Answer: C


NEW QUESTION # 94
A class was written to represent items for purchase in an online store, and a secondclass Representing items that are on sale at a discounted price. THe constructor sets the name to the first value passed in. The pseudocode is below:
Class Item {
constructor(name, price) {
... // Constructor Implementation
}
}
Class SaleItem extends Item {
constructor (name, price, discount) {
...//Constructor Implementation
}
}
There is a newrequirement for a developer to implement a description method that will return a brief description for Item and SaleItem.
Let regItem =new Item('Scarf', 55);
Let saleItem = new SaleItem('Shirt' 80, -1);
Item.prototype.description = function () { return 'This is a ' + this.name; console.log(regItem.description()); console.log(saleItem.description()); SaleItem.prototype.description = function () { return 'This is a discounted ' + this.name; } console.log(regItem.description()); console.log(saleItem.description()); What is the output when executing the code above ?

  • A. This is aScarfUncaught TypeError: saleItem.description is not a functionThis is a ShirtThis is a did counted Shirt
  • B. This is a ScarfUncaught TypeError: saleItem.description is not a functionThis is aScarfThis is a discounted Shirt
  • C. This is a ScarfThis is a ShirtThis is a discounted ScarfThis is a discounted Shirt
  • D. This is a ScarfThis is a ShirtThis is a ScarfThis is a discounted Shirt

Answer: D


NEW QUESTION # 95
A developer is wondering whether to use, Promise.then or Promise.catch, especially when a Promise throws an error?
Which two promises are rejected?
Which 2 are correct?

  • A. Promise.reject('cool error here').then(error => console.error(error));
  • B. Promise.reject('cool error here').catch(error => console.error(error));
  • C. New Promise((resolve, reject) => (throw 'cool error here'}).catch(error => console.error(error)) ;
  • D. New Promise(() => (throw 'cool error here'}).then(null, error => console.error(error)));

Answer: B,C


NEW QUESTION # 96
Given the code below:

Which method can be provide a visual representation of the list if users and to allow sorting by the name or email attributes.

  • A. Console.group (userList);
  • B. Console.groupCollapsed (userslist);
  • C. Console.info (userlist);
  • D. Console,table (userslist);

Answer: A


NEW QUESTION # 97
Given the code below:
const delay = sync delay => {
Return new Promise((resolve, reject) => {
setTimeout (resolve, delay);});};
const callDelay =async () =>{
const yup =await delay(1000);
console.log(1);
What is logged to the console?

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

Answer: B


NEW QUESTION # 98
A developer creates a simple webpage with an input field. When a user enters text in the input field and clicks the button, the actual value of the field must be displayed in the console.
Here is the HTML file content:
<input type =" text" value="Hello" name ="input">
<button type ="button" >Display </button> The developer wrote the javascript code below:
Const button = document.querySelector('button');
button.addEvenListener('click', () => (
Const input = document.querySelector('input');
console.log(input.getAttribute('value'));
When the user clicks the button, the output is always "Hello".
What needs to be done to make this code work as expected?

  • A. Replace line 03 with const input = document.getElementByName('input');
  • B. Replace line 02 with button.addEventListener("onclick", function() {
  • C. Replace line 02 with button.addCallback("click", function() {
  • D. Replace line 04 with console.log(input .value);

Answer: D


NEW QUESTION # 99
Given the code below:
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 function Console 16 Bit (name) {
09 GameConsole.call(this, name) ;
10 }
11 Console16bit.prototype = Object.create ( GameConsole.prototype) ;
12 //insert code here
13 console.log( ` $(this.name) is loading a cartridge game : $(gamename) ...`);
14 }
15 const console16bit = new Console16bit(' SNEGeneziz ');
16 console16bit.load(' Super Nonic 3x Force ');
What should a developer insert at line 15 to output the following message using the method ?
> SNEGeneziz is loading a cartridge game: Super Monic 3x Force . . .

  • A. Console16bit = Object.create(GameConsole.prototype).load = function
    (gamename) {
  • B. Console16bit.prototype.load = function(gamename) {
  • C. Console16bit.prototype.load(gamename) = function() {
  • D. Console16bit.prototype.load(gamename) {

Answer: B


NEW QUESTION # 100
Refer to the code below:
for(let number =2 ; number <= 5 ; number += 1 ) {
// insert code statement here
}
The developer needs to insert a code statement in the location shown. The code
statement has these requirements:
1. Does require an import
2. Logs an error when the boolean statement evaluates to false
3. Works in both the browser and Node.js
Which meet the requirements?

  • A. assert (number % 2 === 0);
  • B. console.debug(number % 2 === 0);
  • C. console.error(number % 2 === 0);
  • D. console.assert(number % 2 === 0);

Answer: C


NEW QUESTION # 101
Refer to the code snippet below:
Let array = [1, 2, 3, 4, 4, 5, 4, 4];
For (let i =0; i < array.length; i++)
if (array[i] === 4) {
array.splice(i, 1);
}
}
What is the value of array after the code executes?

  • A. [1, 2, 3, 4, 5, 4]
  • B. [1, 2, 3, 4, 5, 4, 4]
  • C. [1, 2, 3, 5]
  • D. [1, 2, 3, 4, 4, 5, 4]

Answer: D


NEW QUESTION # 102
A developer is setting up a new Node.js server with a client library that is built using events and callbacks.
The library:
Will establish a web socket connection and handle receipt of messages to theserver Will be imported with require, and made available with a variable called we.
The developer also wants to add error logging if a connection fails.
Given this info, which code segment shows the correct way to set up a client with two events that listen at execution time?

  • A. ws.on ('connect', ( ) => { console.log('connected to client'); }}; ws.on('error', (error) => { console.log('ERROR' , error); }};
  • B. ws.on ('connect', ( ) => {console.log('connected to client'); ws.on('error', (error) => { console.log('ERROR' ,error); });});
  • C. ws.connect (( ) => {console.log('connected to client'); }).catch((error) => { console.log('ERROR' , error); }};
  • D. try{ws.connect (( ) => {console.log('connected to client'); });} catch(error) { console.log('ERROR',error); };}

Answer: B


NEW QUESTION # 103
A developer wants to iterate through an array of objects and count the objects and count the objects whose property value, name, starts with the letter N.
Const arrObj = [{"name" : "Zach"} , {"name" : "Kate"},{"name" : "Alise"},{"name" : "Bob"},{"name" :
"Natham"},{"name" : "nathaniel"}
Refer to the code snippet below:
01 arrObj.reduce(( acc, curr) => {
02 //missing line 02
02 //missing line 03
04 ). 0);
Which missing lines 02 and 03 return the correct count?

  • A. Const sum = curr.name.startsWIth('N') ? 1: 0;
    Return curr+ sum
  • B. Const sum = curr.startsWith('N') ? 1: 0;
    Return acc +sum
  • C. Const sum = curr.name.startsWith('N') ? 1: 0;
    Return acc +sum
  • D. Const sum = curr.startsWIth('N') ? 1: 0;
    Return curr+ sum

Answer: C


NEW QUESTION # 104
Given the following code:

What is the output of line 02?

  • A. "null"
  • B. "x-
  • C. "undefined" 0
  • D. 'object"

Answer: D


NEW QUESTION # 105
Refer to the code below:

What is the value of result when the code executes?

  • A. 10-5
  • B. 5-5
  • C. 10-10
  • D. 5-10

Answer: C


NEW QUESTION # 106
A developer wrote the following code:
01 let X = object.value;
02
03 try {
04 handleObjectValue(X);
05 } catch (error) {
06 handleError(error);
07 }
The developer has a getNextValue function to execute after handleObjectValue(), but does not want to execute getNextValue() if an error occurs.
How can the developer change the code to ensure this behavior?

  • A. 03 try {
    04 handleObjectValue(x)
    05 ........................
  • B. 03 try{
    04 handleObjectValue(x);
    05 } catch(error){
    06 handleError(error);
    07 } then {
    08 getNextValue();
    09 }
  • C. 03 try{
    04 handleObjectValue(x);
    05 } catch(error){
    06 handleError(error);
    07 }
    08 getNextValue();
  • D. 03 try{
    04 handleObjectValue(x);
    05 } catch(error){
    06 handleError(error);
    07 } finally {
    08 getNextValue();
    10 }

Answer: A


NEW QUESTION # 107
Refer to the code below:
Let textValue = '1984';
Which code assignment shows a correct way to convert this string to an integer?

  • A. Let numberValue = (Number)textValue;
  • B. let numberValue = Number(textValue);
  • C. Let numberValue = textValue.toInteger();
  • D. Let numberValue = Integer(textValue);

Answer: B


NEW QUESTION # 108
......

Verified JavaScript-Developer-I exam dumps Q&As with Correct 224 Questions and Answers: https://www.free4torrent.com/JavaScript-Developer-I-braindumps-torrent.html

Get New JavaScript-Developer-I Certification – Valid Exam Dumps Questions: https://drive.google.com/open?id=1_yydraGrpUWmK3MbeP_GEB_qRZlxs9V6