Salesforce JavaScript-Developer-I Sample Questions

Question # 21

A developer wants to create an object from a function in the browser using the code below.


What happens due to the lack of the mm keyword on line 02?

A. window.name is assigned to'hello' and the variable = remains undefined.
B. window.m Is assigned the correct object.
C. The m variable is assigned the correct object but this.name remains undefined.
D. The m variable is assigned the correct object.


Question # 22

A developer wants to use a module called DataPrettyPrint. This module exports one default functioncalled printDate (). How can a developer import and use the printDate() function?

 

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


Question # 23

A developer has a formatName function that takes two arguments, firstName and lastName and returns a string. They want to schedule the function to run once after five seconds. What is the correctsyntax toschedule this function? 

A. setTimeout (formatName(), 5000, "John", "BDoe");
B. setTimeout (formatName('John', ‘'Doe'), 5000);
C. setTimout(() => { formatName("John', 'Doe') }, 5000);
D. setTimeout ('formatName', 5000, 'John", "Doe');


Question # 24

A developer initiates a server with thefile server,js and adds dependencies in the source codes package,json that are required to run the server. Which command should the developer run to start the server locally? 

A. start server,js
B. npm start server,js
C. npm start
D. node start


Question # 25

Refer to the HTML below:


Which JavaScript statement results in changing “ The Lion.”?

A. document.querySelectorAll(‘$main $TONY’).innerHTML = ’“ The Lion
B. document.querySelector(‘$main li:second-child’).innerHTML = “The Lion ’;
C. document.querySelector(‘$main li.Tony’).innerHTML = ’“ The Lion ’;
D. document.querySelector(‘$main li:nth-child(2)’),innerHTML = “ The Lion. ’;


Question # 26

Refer of the string below: Const str = ‘sa;esforce’=; Which two statement result in the word 'Sale'? Choose 2 answers 

A. str, substring(0,5) ;
B. str, substr(0,5) ;
C. str, substring(1,5) ;
D. str, substr(1,5) ;


Question # 27

A developer receives a comment from the Tech Lead that thecode given below has error: const monthName = ‘July’; const year = 2019; if(year === 2019) { monthName =‘June’; } Which line edit should be made to make this code run? 

A. 01 let monthName =’July’;
B. 02 let year =2019;
C. 02 const year = 2020;
D. 03 if(year == 2019) {


Question # 28

Refer to the code declarations below:


Whichthree expressions return the string JavaScript? Choose 3 answers 

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


Question # 29

Which option istrue about the strict mode in imported modules?

A. Add the statement use non-strict, before any other statements in the module toenablenot-strict mode.
B. You can only reference notStrict() functions from the imported module.
C. Imported modules are in strict mode whether you declare them as such or not.
D. Add the statement use strict =false; before any other statements in the module toenablenot- strict mode.


Question # 30

Refer to code below: Const objBook = { Title: ‘Javascript’, }; Object.preventExtensions(objBook); Const newObjBook = objBook; newObjectBook.author =‘Robert’; What are the values of objBook and newObjBook respectively ? 

A. [title: “javaScript”] [title: “javaScript”]
B. {author: “Robert”, title: “javaScript}Undefined
C. {author: “Robert”, title: “javaScript}{author: “Robert”, title: “javaScript}
D. {author: “Robert”}{author: “Robert”, title: “javaScript}


12345Last ›

Download All Questions PDF Check Customers Feedbacks