Summer Certification Special Limited Time 70% Discount Offer - Ends in 0d 00h 00m 00s - Coupon code: force70

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

Viewing page 1 out of 5 pages
Viewing questions 1-10 out of questions
Questions # 1:

A page loads 50+ < div class= " ad-library-item " > elements, all ads.

Developer wants to quickly and temporarily remove them.

Options:

Options:

A.

Use the browser console to execute a script that prevents the load event from firing.


B.

Use the DOM inspector to prevent the load event from firing.


C.

Use the browser console to execute a script that removes all elements containing the class ad-library-item.


D.

Use the DOM inspector to remove all elements containing the class ad-library-item.


Expert Solution
Questions # 2:

Original constructor function:

01 function Vehicle(name, price) {

02 this.name = name;

03 this.price = price;

04 }

05 Vehicle.prototype.priceInfo = function () {

06 return `Cost of the $(this.name) is $(this.price)$`;

07 }

08 var ford = new Vehicle( ' Ford Fiesta ' , ' 20,000 ' );

Which class definition is correct?

Options:

A.

class Vehicle {

constructor(name, price) {

this.name = name;

this.price = price;

}

priceInfo() {

return ' Cost of the ${this.name} is ${this.price}$ ' ;

}

}


B.

class Vehicle {

vehicle(name, price) {

this.name = name;

this.price = price;

}

priceInfo() {

return ' Cost of the ${this.name} is ${this.price}$ ' ;

}

}


C.

class Vehicle {

constructor() {

this.name = name;

this.price = price;

}

priceInfo() {

return `Cost of the ${this.name} is ${this.price}$`;

}

}


D.

class Vehicle {

constructor(name, price) {

this.name = name;

this.price = price;

}

priceInfo() {

return `Cost of the ${this.name} is ${this.price}$`;

}

}


Expert Solution
Questions # 3:

Corrected code:

function Person() {

this.firstName = " John " ;

}

Person.prototype = {

job: x = > " Developer "

};

const myFather = new Person();

const result = myFather.firstName + " " + myFather.job();

What is the value of result after line 10 executes?

Options:

A.

" John Developer "


B.

" John undefined "


C.

Error: myFather.job is not a function


D.

" undefined Developer "


Expert Solution
Questions # 4:

A developer writes the code below to return a message to a user attempting to register a new username. If the username is available, a variable named msg is declared and assigned a value on line 03.

function getAvailabilityMessage(item) {

if (getAvailability(item)) {

var msg = " Username available " ;

return msg;

}

}

Options:

A.

" msg is not defined "


B.

" newUserName "


C.

" Username available "


D.

undefined


Expert Solution
Questions # 5:

HTML:

< p > The current status of an Order: < span id= " status " > In Progress < /span > < /p >

Which JavaScript statement changes ' In Progress ' to ' Completed ' ?

Options:

A.

document.getElementById( " .status " ).innerHTML = ' Completed ' ;


B.

document.getElementById( " #status " ).innerHTML = ' Completed ' ;


C.

document.getElementById( " status " ).innerHTML = ' Completed ' ;


D.

document.getElementById( " status " ).Value = ' Completed ' ;


Expert Solution
Questions # 6:

Refer to the code below:

< html >

< body >

< div id= " logo " > Hello Logo! < /div >

< button id= " test " > Click me < /button >

< /body >

< script >

function printMessage(event) {

console.log( ' This is a test message ' );

}

let el = document.getElementById( ' test ' );

el.addEventListener( " click " , printMessage, false);

< /script >

< /html >

Which action should be done?

Options:

A.

Add event.removeEventListener(); to window.onload event handler


B.

Add event.removeEventListener(); to printMessage function


C.

Add event.stopPropagation(); to printMessage function


D.

Add event.stopPropagation(); to window.onload event handler


Expert Solution
Questions # 7:

A developer at Universal Containers creates a new landing page based on HTML, CSS, and JavaScript.

To ensure that visitors have a good experience, a script named personalizeWebsiteContent needs to be executed to do some custom initialization when the webpage is fully loaded with HTML content and all related files.

Which statement should be used to call personalizeWebsiteContent based on the above business requirement?

Options:

A.

document.addEventListener( ' DOMContentLoaded ' , personalizeWebsiteContent);


B.

document.addEventListener( ' onDOMContentLoaded ' , personalizeWebsiteContent);


C.

window.addEventListener( ' load ' , personalizeWebsiteContent);


D.

window.addEventListener( ' onload ' , personalizeWebsiteContent);


Expert Solution
Questions # 8:

Refer to the code below:

const pi = 3.1415926;

What is the data type of pi?

Options:

A.

Number


B.

Float


C.

Double


D.

Decimal


Expert Solution
Questions # 9:

A developer initiates a server with the file server.js and adds dependencies in the source code ' s package.json that are required to run the server.

Which command should the developer run to start the server locally?

Options:

A.

node start


B.

npm start


C.

npm start server.js


D.

start server.js


Expert Solution
Questions # 10:

Refer to the following object:

01 const cat = {

02 firstName: ' Fancy ' ,

03 lastName: ' Whiskers ' ,

04 get fullName(){

05 return this.firstName + ' ' + this.lastName;

06 }

07 };

How can a developer access the fullName property for cat?

Options:

A.

cat.fullName()


B.

cat.get.fullName


C.

cat.function.fullName()


D.

cat.fullName


Expert Solution
Viewing page 1 out of 5 pages
Viewing questions 1-10 out of questions