Salesforce JavaScript-Developer-I Sample Questions

Question # 31

Given the JavaScript below: 01 function filterDOM (searchString) { 02 constparsedSearchString = searchString && searchString.toLowerCase() ; 03 document.quesrySelectorAll(‘ .account’ ) . forEach(account => ( 04 const accountName = account.innerHTML.toLOwerCase(); 05 account. Style.display = accountName.includes(parsedSearchString) ? /*Insert code*/; 06 )}; 07 } Which code should replace the placeholder comment on line 05 to hide accounts that do not match thesearch string? 

A. ‘ name ’ : ‘ block ’
B. ‘ Block ’ : ‘ none ’
C. ‘ visible ’ : ‘ hidden ’
D. ‘ hidden ’ : ‘ visible ’


Question # 32

Considering the implications of 'use strict' on line 04, which three statements describe the execution of the code? Choose 3 answers 

A. z is equal to 3.14.
B. 'use strict' is hoisted, so it has an effect on all lines.
C. 'use strict' has an effect only on line 05.
D. 'use strict' has an effect between line 04 and theend of the file.
E. Line 05 throws an error.


Question # 33

Refer to the following code:


Which statement should be added to line 09 for the code to display. The boat has a capacity of 10 people? 

A. super.size = size;
B. ship.size size;
C. super (size);
D. this.size = size;


Question # 34

A developer is working onan ecommerce website where the delivery date is dynamically calculated based on the current day. The code line below is responsible for this calculation. Const deliveryDate = new Date (); Due to changes in the business requirements, the delivery date mustnow be today’s date + 9 days. Which code meets thisnew requirement? 

A. deliveryDate.setDate(( new Date ( )).getDate () +9);
B. deliveryDate.setDate( Date.current () + 9);
C. deliveryDate.date = new Date(+9) ;
D. deliveryDate.date = Date.current () + 9;


Question # 35

Refer to the following code: <html lang=”en”> <body> <divonclick = “console.log(‘Outer message’) ;”> <button id =”myButton”>CLick me<button> </div> </body> <script> function displayMessage(ev) { ev.stopPropagation(); console.log(‘Inner message.’); } const elem = document.getElementById(‘myButton’); elem.addEventListener(‘click’ , displayMessage); </script> </html> What will the console show when the button is clicked? 

A. Outer message
B. Outer messageInner message
C. Inner messageOuter message
D. Inner message


Question # 36

Refer to the code below: ConstresolveAfterMilliseconds = (ms) => Promise.resolve ( setTimeout ((=> console.log(ms), ms )); Const aPromise = await resolveAfterMilliseconds(500); Const bPromise = await resolveAfterMilliseconds(500); Await aPromise, wait bPromise; What is the result of running line 05? 

A. aPromise and bPromise run sequentially.
B. Neither aPromise or bPromise runs.
C. aPromise and bPromise run in parallel.
D. Only aPromise runs.


Question # 37

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 values of the carSpeed and fourWheels variables
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 informationstored in the window.localStorage property


Question # 38

A developer is setting up a Node,js server and is creating a script at the root of the source code, index,js, that will start the server when executed. The developer declares a variable that needsthe folder location that the code executes from. Which global variable can be used in the script? 

A. window.location
B. _filename
C. _dirname
D. this.path


Question # 39

In the browser, the window objectis often used to assign variables that require the broadest scope in an application Node.js application does not have access to the window object by default. Which two methods areused to address this ? Choose 2 answers 

A. Use the document object instead of the window object.
B. Assign variables to the global object.
C. Create a new window object in the root file.
D. Assign variables to module.exports and require them as needed.


Question # 40

Refer to HTML below: <div id=”main”> <div id = “ card-00”>This card is smaller.</div> <div id = “card-01”>The width and height of this card is determined by its contents.</div> </div> Which expression outputs the screen width of the element with the ID card-01? 

A. document.getElementById(‘ card-01 ’).getBoundingClientRest().width
B. document.getElementById(‘ card-01 ’).style.width
C. document.getElementById(‘ card-01 ’).width
D. document.getElementById(‘ card-01 ’).innerHTML.lenght*e


‹ First23456

Download All Questions PDF Check Customers Feedbacks