Pass the Salesforce Salesforce Developer JavaScript-Developer-I Questions and answers with CertsForce

Viewing page 6 out of 7 pages
Viewing questions 51-60 out of questions
Questions # 51:

Refer to the code below:

Function changeValue(obj) {

Obj.value = obj.value/2;

}

Const objA = (value: 10);

Const objB = objA;

changeValue(objB);

Const result = objA.value;

What is the value of result after the code executes?

Options:

A.

10


B.

Nan


C.

5


D.

Undefined


Expert Solution
Questions # 52:

At Universal Containers, every team has its own way of copying JavaScript objects. The

code

Snippet shows an implementation from one team:

Function Person() {

this.firstName = “John”;

this.lastName = ‘Doe’;

This.name =() => (

console.log(‘Hello $(this.firstName) $(this.firstName)’);

)}

Const john = new Person ();

Const dan =JSON.parse(JSON.stringify(john));

dan.firstName =’Dan’;

dan.name();

What is the Output of the code execution?

Options:

A.

Hello Dan Doe


B.

Hello John DOe


C.

TypeError: dan.name is not a function


D.

TypeError: Assignment to constant variable.


Expert Solution
Questions # 53:

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 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 . . .

Options:

A.

Console16bit.prototype.load(gamename) = function() {


B.

Console16bit.prototype.load = function(gamename) {


C.

Console16bit = Object.create(GameConsole.prototype).load = function(gamename) {


D.

Console16bit.prototype.load(gamename) {


Expert Solution
Questions # 54:

A developer creates an object where its properties should be immutable and prevent

properties from being added or modified.

Which method should be used to execute this businessrequirement ?

Options:

A.

Object.const()


B.

Object.eval()


C.

Object.lock()


D.

Object.freeze()


Expert Solution
Questions # 55:

Refer to the code below:

Question # 55

Which replacement for the conditionalstatement on line 02 allows a developer to correctly determine

that a specific element, myElement on the page had been clicked?

Options:

A.

event.target.id =='myElement'


Expert Solution
Questions # 56:

A developer has the following array of hourly wages:

Let arr = (8, 5, 9, 75, 11, 25, 7, 75, , 13, 25);

For workers making less than $10 an hour rate should be multiple by 1.25 and returned in a new array.

How should the developer implement the request?

Options:

A.

let arrl = arr.filter((val) => val < 10).map((num) -> num = 1.25);


B.

let arrl = arr .rr.acArray ((val) => ( val < 10 )) ,map((num) => { num * 1.25 ));


C.

let arrl = arr-map((num) => { return ran * 1.25 }).filter((val) -> { return val < 10));


D.

let arrl = arr.filterBy((val) => val < 10 ).aapBy<(num) -> num = ..25 );


Expert Solution
Questions # 57:

Given HTML below:

UniversalContainer

Applied Shipping

Burlington Textiles

Which statement adds the priority = account CSS class to the universal Containers row ?

Options:

A.

Document .querySelector(‘#row-uc’).classes.push(‘priority-account’);


B.

Document .queryElementById(‘row-uc’).addclass(‘priority-account’);


C.

Document .querySelector(‘#row-uc’).classList.add(‘priority-account’);


D.

Document .querySelectorALL(‘#row-uc’).classList.add(‘priority-account’);


Expert Solution
Questions # 58:

Which two code snippets showworking examples of a recursive function?

Choose 2 answers

Options:

A.

Let countingDown = function(startNumber) {If ( startNumber >0) {console.log(startNumber) ;return countingDown(startNUmber);} else {return startNumber;}};


B.

Function factorial ( numVar ) {If (numVar < 0) return;If ( numVar === 0 ) return 1;return numVar -1;


C.

Const sumToTen = numVar => {If (numVar < 0)Return;return sumToTen(numVar + 1)};


D.

Const factorial =numVar => {If (numVar < 0) return;If ( numVar === 0 ) return 1;returnnumVar * factorial ( numVar - 1 );};


Expert Solution
Questions # 59:

Referto the following code:

Question # 59

Which two statement could be inserted at line 17 to enable the function call on line 18?

Choose 2 answers

Options:

A.

Object.assign (leo, tony);


B.

Object.assign (leo. Tiger);


C.

leo.roar = () => { console.log('They\'re pretty good!'); );


D.

leo.prototype.roar = ( ) =>( console.log('They\'re pretty good!'); };


Expert Solution
Questions # 60:

Refer to the code snippet:

Function getAvailabilityMessage(item) {

If (getAvailability(item)){

Var msg =”Username available”;

}

Return msg;

}

A developer writes this code to return a message to user attempting to register a new

username. If the username is available, variable.

What is the return value of msg hen getAvailabilityMessage (“newUserName” ) is

executed and getAvailability(“newUserName”) returns false?

Options:

A.

“Username available”


B.

“newUserName”


C.

“Msg is not defined”


D.

undefined


Expert Solution
Viewing page 6 out of 7 pages
Viewing questions 51-60 out of questions