Practice Free Salesforce Certified JavaScript Developer Exam Online Questions
Refer tothe code below:

What is the value of result after line 10 executes?
- A . Error: myFather.job is not a function
- B . John Developer
- C . undefined Developer
- D . John undefined
Refer to HTML below:
<p> The current status of an Order: <span id =”status”> In Progress </span> </p>.
Which JavaScript statement changes the text ‘In Progress’ to ‘Completed’?
- A . document.getElementById(“status”).Value = ’Completed’ ;
- B . document.getElementById(“#status”).innerHTML = ’Completed’ ;
- C . document.getElementById(“status”).innerHTML = ’Completed’ ;
- D . document.getElementById(“.status”).innerHTML = ’Completed’ ;
Refer to the code below:
const event = new CustomEvent(
//Missing Code
);
obj.dispatchEvent(event);
A developer needs to dispatch a custom event called update to send information about recordId.
Which two options could a developer insert at the placeholder in line 02 to achieve this? Choose 2 answers
- A . ‘Update’, (recordId: ‘123abc’(
- B . ‘Update’, ‘123abc’
- C . {type: ‘update’, recordId: ‘123abc’}
- D . ‘Update’, {Details: {recordId: ‘123abc’}}
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 errorhere’).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)));
In the browser, the window object is 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.
Refer to the code below:
Function Person (firstName, lastName, eyecolor) {
this.firstName =firstName;
this.lastName = lastName;
this.eyeColor = eyeColor;
}
Person.job = ‘Developer’;
const myFather = new Person(‘John’, ‘Doe’);
console.log(myFather.job);
What is the output after the code executes?
- A . ReferenceError: eyeColor is not defined
- B . ReferenceError: assignment to undeclared variable “Person”
- C . Developer
- D . Undefined
Refer to the code below:
01 const server = require(‘server’);
02 /* Insert code here */
A developer imports a library that creates a web server. The imported library uses events and callbacks to start the servers
Which code should be inserted at the line 03 to set up an event and start the web server?
- A . Server.start ();
- B . server.on(‘ connect ’, (port) => {console.log(‘Listening on ’, port) ;})
- C . server()
- D . serve(( port) => (
- E . console.log( ‘Listening on ’, port) ;
Given the JavaScript below:

Which code should replace the placeholder comment on line 06 to hide accounts that do not match the search string?
- A . ‘None’: ‘block’
- B . ‘Visible: ’hidden’
- C . ‘Hidden, visible
- D . ‘Block’: ‘none’
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.slice(0, 5);
- B . Let arr2 = Array.from(arr1);
- C . Let arr2 = arr1;
- D . Let arr2 = arr1.sort();
Refer to the code below:
Async funct on functionUnderTest(isOK) {
If (isOK) return ‘OK’;
Throw new Error(‘not OK’);
)
Which assertion accurately tests the above code?
- A . Console.assert (await functionUnderTest(true), ‘OK’)
- B . Console.assert (await functionUnderTest(true), ‘not OK’)
- C . Console.assert (await functionUnderTest(true), ‘notOK’)
- D . Console.assert (await functionUnderTest(true), ‘OK’)
