Salesforce Certified JavaScript Developer I Mock Test
Salesforce Certified JavaScript Developer I — Free Practice Exam
Progress: 0 / 50 answered
Scroll down & click Submit when done
1
What is the output of the following code?
const arr = [1, 2, 3]; const [a, , b] = arr; console.log(a, b);2
Which keyword should be used to declare a variable that is block-scoped and cannot be reassigned?
3
What does the spread operator (...) do when used with an array?
4
Which of the following correctly defines an arrow function that takes two parameters and returns their sum?
5
What is a closure in JavaScript?
6
What is the correct syntax for a template literal that includes a variable?
7
What does
Promise.all() return if one of the promises in the array rejects?8
Which LWC decorator is used to expose a property or method so a parent component can access it?
9
In LWC, which lifecycle hook is called after the component's element is inserted into the DOM?
10
What is the correct way to export a function named
greet as a named export from a JavaScript module?11
Which method is used to make an HTTP request using the modern browser API (without third-party libraries)?
12
In an LWC component, the
@wire decorator is used to:13
What is the purpose of
async/await in JavaScript?14
Which of the following correctly demonstrates object destructuring in ES6?
15
In JavaScript, what does the
typeof operator return for null?16
Which method is used in Jest to create a mock function that can track calls and return values?
17
In the Module design pattern, what is the main purpose?
18
What is the difference between
== and === in JavaScript?19
Which LWC lifecycle hook is invoked each time the component finishes rendering?
20
What does the rest parameter (...args) do in a function definition?
21
In JavaScript classes (ES6+), what is the purpose of the
super() call inside a constructor?22
How does an LWC child component communicate an event upward to its parent?
23
Which Jest matcher verifies that a function was called a specific number of times?
24
What is "hoisting" in JavaScript?
25
In the Observer design pattern, what role does the subject play?
26
What is the output of
console.log(0.1 + 0.2 === 0.3); in JavaScript?27
In Aura framework, which method is used to create a component dynamically at runtime?
28
Which of the following correctly imports a default export from a module named "utils.js"?
29
Which DOM method selects the first element matching a CSS selector?
30
In the Singleton pattern, what guarantees that only one instance of a class is created?
31
In Node.js, which global object provides information about the current module's file path?
32
What does
event.preventDefault() do in JavaScript event handling?33
Which array method returns a new array containing only the elements that pass a test function?
34
In LWC, the Shadow DOM ensures that:
35
What is the correct way to handle errors in an async/await function?
36
In JavaScript, which statement about
let and var is TRUE?37
Which Node.js module is used to work with file paths in a cross-platform manner?
38
What is the primary difference between
Promise.all() and Promise.allSettled()?39
In an LWC component, which method is used to access a child element in the template using a template reference?
40
What does the
Array.prototype.map() method return?41
In JavaScript, what is the prototype chain used for?
42
What is the purpose of
jest.mock('moduleName') in a Jest test?43
What happens when you use
var inside a for loop in JavaScript?44
In the Aura framework, which attribute is used to pass data from a parent component to a child component?
45
Which ES6 feature allows you to define default values for function parameters?
46
In JavaScript, which statement about arrow functions and
this is TRUE?47
What is the correct way to create an LWC component that listens for a platform event using the wire service?
48
Which method stops event propagation in the DOM so parent elements do not receive the event?
49
In Jest, which function is used to group related test cases together?
50
What is the output of:
const obj = {a: 1}; const copy = {...obj, b: 2}; console.log(copy);Answered 0 of 50 questions. You can submit at any time.