Refer the code below.
x=3.14;
function myfunction() {
"use strict";
y=x;
}
z=x;
myFunction();
Answer is in the explanation below.
Loading demo links...
Showing 1–15 of 15 questions
Refer the code below.
x=3.14;
function myfunction() {
"use strict";
y=x;
}
z=x;
myFunction();
Answer is in the explanation below.
A developer wrote the following code to test a sum3 function that takes in an array of numbers and returns the sum of the first three numbers in the array, and the test passes.
A different developer made changes to the behavior of sum3 to instead sum only the first two numbers present in the array.

Which two results occur when running this test on the updated sum3 function?
Choose 2 answers
Select all that apply, then click Submit answer.
The line 05 assertion passes.
The line 02 assertion passes.
The line 02 assertion fails.
The line 05 assertion fails.
Refer to the string below:
const str = 'Salesforce';
Which two statements result in the word 'Sales'?
Choose 2 answers
Select all that apply, then click Submit answer.
str.substr(1, 5);
str.substr (0, 5);
str.substring (1, 5);
str.substring (0, 5);
A developer implements a function that adds a few values.

Which three options can the developer invoke for this function to get a return value of 10? (Choose three.)
Select all that apply, then click Submit answer.
sum(5) (5)
sum() (10)
sum(5, 5) ()
sum(10) ()
sum() (5, 5)
Which two options are core Node.js modules?
Choose 2 answers
Select all that apply, then click Submit answer.
worker
isotream
exception
http
A developer is wondering whether to use, Promise.then or Promise.catch, especially when a promise throws an error.
Which two promises are rejected? (Choose two.)
Select all that apply, then click Submit answer.
new Promise(() => {throw ‘Cool error here’}).then((null, error => console.error(error)));
new Promise((resolve, reject) => {throw ‘Cool error here’}).catch
(error => console.error(error));
Promise.reject(‘Cool error here’).then(error => console.error(error));
Promise.reject(‘Cool error here’).catch(error => console.error (error));
Refer to the code below:

Which two statements correctly execute the runParallel() function? (Choose two.)
Select all that apply, then click Submit answer.
runParallel().then(data);
runParallel().done(function(data){ return data;
});
async runParallel().then(data);
runParallel().then(function(data){ return data;
});
A developer uses a parsed JSON string to work with user information as in the block below:
01 const userInformation ={
02 “ id ” : “user-01”,
03 “email” : “user01@universalcontainers.demo”,
04 “age” : 25
Which two options access the email attribute in the object?
Choose 2 answers
Select all that apply, then click Submit answer.
userInformation(“email”)
userInformation.get(“email”)
userInformation.email
userInformation(email)
Refer to code below:
Function muFunction(reassign){
Let x = 1;
var y = 1;
if( reassign ) {
Let x= 2;
Var y = 2;
console.log(x);
console.log(y);}
console.log(x);
console.log(y);}
What is displayed when myFunction(true) is called?
Select an option, then click Submit answer.
2 2 1 1
2 2 undefined undefined
2 2 1 2
2 2 2 2
A developer is setting up a new Node.js server with a client library that is built using events and callbacks.
The library:
Will establish a web socket connection and handle receipt of messages to the server
Will be imported with require, and made available with a variable called ws.
The developer also wants to add error logging if a connection fails.
Given this information, which code segment shows the correct way to set up a client with two events that listen at execution time?
A.
B. C.
D.
Answer: B
Explanation:
Select an option, then click Submit answer.
C.
D.
A developer has an ErrorHandler module that contains multiple functions.
What kind of export be leverages so that multiple functions can be used?
Select an option, then click Submit answer.
Named
All
Multi
Default
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 business requirement ?
Select an option, then click Submit answer.
Object.const()
Object.eval()
Object.lock()
Object.freeze()
Refer to the code below:

What is the result when the Promise in the execute function is rejected?
Select an option, then click Submit answer.
Resolved1 Resolved2 Resolved3 Resolved4
Rejected
Rejected Resolved
Rejected1 Rejected2 Rejected3 Rejected Rejected Rejected4
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 nag is declared and assigned a value on line 03.

What is the value of msg when getAvailableabilityMessage (“newUserName”) is executed and get Availability (“newUserName”) returns true?
Select an option, then click Submit answer.
"msg is not defined"
"newUserName"
"User-name available"
undefined
A developer creates a simple webpage with an input field. When a user enters text in
the input field and clicks the button, the actual value of the field must be displayed in the
console.
Here is the HTML file content:
The developer wrote the javascript code below:
Const button = document.querySelector(‘button’);
button.addEvenListener(‘click’, () => (
Const input = document.querySelector(‘input’);
console.log(input.getAttribute(‘value’));
When the user clicks the button, the output is always “Hello”.
What needs to be done make this code work as expected?
Select an option, then click Submit answer.
Replace line 04 with console.log(input .value);
Replace line 03 with const input = document.getElementByName(‘input’);
Replace line 02 with button.addEventListener(“onclick”, function() {
Replace line 02 with button.addCallback(“click”, function() {
This free practice test covers the Salesforce Certified JavaScript Developer I (JavaScript-Developer-I) exam from Salesforce. The 15 questions come free from the full 271-question Study4Pass practice set — a quick, honest check of where you stand. The free sample includes 7 single-answer, 7 multiple-answer and 1 hands-on lab questions — the same mix of formats you will meet in the full set. The set follows the real exam’s spread of topics: Topics such as Lightning Components, Lightning App Builder, Lightning Flow and Apex Programming. The Salesforce JavaScript-Developer-I exam is an entry-level Salesforce certification exam designed to validate your knowledge and skills in developing custom user interfaces and applications using the Lightning Platform, Visualforce, and Apex.
The target audience for the Salesforce JavaScript-Developer-I exam is individuals who have at least six months of experience developing applications using JavaScript and the Salesforce platform. The Salesforce JavaScript-Developer-I exam does not have any prerequisites.
Work through the questions one at a time and read every explanation, even for the ones you get right — the reasoning behind an answer is what the real exam tests. If one area keeps costing you marks, you have found exactly what to revise before exam day.
Think of the result as a map, not a verdict. The questions you miss point straight at the topics that need work, and the explanations tell you why the correct option wins. Candidates who loop through that cycle — practise, review the reasoning, re-test — walk into the real exam having already seen their weak spots and fixed them.
Inside the full JavaScript-Developer-I practice set:
There is no clock and no account needed. Answer each question, check the result, and read the explanation before moving on. For anything that still feels unclear, Ask AI is built into this AI-Enabled practice test — it explains the concept behind the question so the next one like it gets easier. Ready for more? The full 271-question set adds a timed Exam Simulation mode, topic training for your weak areas, and a flagged-question review, so you can practise the way the real exam feels.
Yes — the 15 questions on this page are completely free, with no signup and no payment details needed.
271 questions. The 15 free questions above are a sample of that full set, in the same style and topic balance.
Yes — every question shows the correct answer with an explanation, and Ask AI can explain the concept behind a question in plain words if you want to go deeper.
No. This is a practice test: the questions are written to mirror the real JavaScript-Developer-I exam’s topics and difficulty, not copied from it.