Browse all practice questions for the Salesforce JavaScript Developer I Certification Practice Exam. Search by topic, open any question and review its full explanation, then test yourself in the practice quiz.

Salesforce JavaScript Developer I Certification Practice Exam course image
More practice questions

These questions are part of the practice quiz. Start practicing

  • What is the main difference between == and === in JavaScript?
  • What will be logged when executing the following code: emp.fullName ='John Smith'; console.log(emp.fName);?
  • What will be the output when calling member.getFullName() if getFullName is not added to the prototype?
  • How do you prevent creating a global variable when mistyping a variable name?
  • If a property of an object is sealed, what can you not do?
  • What type of object is always returned when using async in JavaScript?
  • What will the console output be for console.log(arr.filter(x => x % 2)) with arr being [1, 4, 9, 16]?
  • What will be the log output for the following code: console.log(JSON.stringify([new Number(3), new String('false'), new Boolean(false)]));
  • What needs to be called in the constructor of Student to instantiate the parent class Person?
  • What will be the output of console.log(arr.map(x => x * 2)) for the array [1, 4, 9, 16]?
  • What will be logged when executing the statement console.log(typeof typeof 1);?
  • What will be the console output of the following code segment: console.log(eval('2 + 2'))?
  • What will be the output when calling multiply() four times in succession, where multiply is defined as: const multiply = (x = { ...value }) => { console.log((x.number *= 2)); };?
  • What is a key characteristic of the `let` keyword?
  • What is a common characteristic of Lightning Web Components?
  • What does the pushstate() method do in the History API?
  • Which statement best describes the lifecycle of a Lightning Web Component?
  • What is the result of the statement sum(1, '2')?
  • What does the return value of a function declared with the function keyword default to if not specified?
  • What will the output be for console.log(paragraph.match(/[A-Z]/)) where paragraph is 'The quick brown fox jumps over the lazy dog. It barked.'?
  • What are the three phases of event propagation in order?
  • What command is used to handle errors in JavaScript promises?
  • Which statement is used to stop event propagation in JavaScript?
  • What will the output be if a function is invoked without passing an expected argument that has a default parameter value?
  • What distinguishes white-box testing from black-box testing?
  • What does the setInterval method return in the browser?
  • Which constructor correctly extends the Dog class with a Labrador class constructor?
  • What defines a pure function in JavaScript?
  • In JavaScript, what will happen if you try to access a variable declared with let before it is initialized?
  • In JavaScript, what is the result of using the unary operator ++ on a variable?
  • What is the standard way to execute asynchronous code in JavaScript?
  • Which of the following statements about variable hoisting is correct?
  • How do you share code between different Lightning Web Components?
  • What will be the result of executing console.log(arr.slice(1, 3)) for arr being [1, 4, 9, 16]?
  • What happens to the dependency versions when a package has a peer dependency?
  • What is the correct way to remove an event listener in JavaScript?
  • How can methods in LWC be invoked from the template?
  • What is the output produced by the following code: const settings = { username: 'lydiahallie', level: 19, health: 90 }; const data = JSON.stringify(settings, ['level', 'health']); console.log(data);?
  • If a paragraph is clicked inside a div, what will be the output in the console?
  • What will be logged to the console when the variable num is redeclared using var?
  • What will be the output of the following code snippet?
  • What is indicated by the presence of an array as a second argument in JSON.stringify?
  • What does the 'render' method control in an LWC?
  • In LWC, what decorator is used to expose properties and methods to other components?
  • What is the primary reason a developer cannot access a variable defined inside a function from outside that function?
  • What is the simulated DOM in LWC?
  • What is the purpose of an 'import' statement in JavaScript?
  • What is the main advantage of using Lightning Web Components?
  • What will be the output when calling sayHi with the call method on the person object?
  • What is the main benefit of using asynchronous programming in JavaScript?
  • In what scenario would you use a promise in JavaScript?
  • Which statement regarding the following code is true?
  • After setting person to null, what will console.log(members) output if members was initially equal to [{ name: 'Lydia' }]?
  • Which of the following best describes strict equality (===) in JavaScript?
  • Which block of code executes regardless of whether an exception was caught?
  • Which method is commonly used to manage errors when fetching data in LWC?
  • What is one of the main benefits of using popular frameworks?
  • What will happen when attempting to call freddie.colorChange('orange')?
  • What is the correct method to listen for incoming request data in an HTTPS server?
  • In JavaScript, which operator is used to check for both value and type equality?
  • When creating a class in JavaScript, which of the following is autogenerated?
  • What does the 'this' keyword refer to in JavaScript?
  • What does the valueOf() method do when used on a String object in JavaScript?
  • What will be logged by the following code?
  • In JavaScript, what data structure is used to store key-value pairs?
  • Can third-party libraries be used in LWC?
  • When should you prefer using event delegation in LWC?
  • What will be logged for console.log(Kris.age) when the Person prototype is changed?
  • What does 'event bubbling' mean in the context of web components?
  • How can you create a modal dialog in a Lightning web component?
  • Which JavaScript function is used to define a method in a class?
  • What lines of code need to be added in the Student constructor to properly inherit from Person?
  • Which line of code correctly asserts that the sumArr method returns the expected sum?
  • What is the output of the following comparisons?
  • What is the role of the 'fetch' API in JavaScript?
  • What does the 'spread' syntax allow you to do with arrays and objects?
  • What is the purpose of using setTimeout() in JavaScript?
  • In a nested event listener scenario, what gets executed first?
  • When defining a function in JavaScript, what is the effect of naming the function with the same name as a global variable?
  • What does the console.log display when calling console.log(obj) after redeclaring the key 'a'?
  • Which method is used to resolve promises?
  • What does JSON.stringify do in JavaScript?
  • What will happen if you declare variables in module scope without using var, let, or const?
  • What will be the output of console.log(jim.age) and console.log(jim.__proto__.age) given that the prototype age has been set to 29 and jim's age is 18?
  • What are decorators in the context of Lightning Web Components?
  • What is the result of calling console.log(sarah) when not using the new keyword?
  • Do all objects in JavaScript have prototypes?
  • In the event bubbling example, what element is considered the event target when the button is clicked?
  • What is the output of the following code snippet: let x = [1]; x.push(x); console.log(x);?
  • What will console.log(undefined) give during the execution of checkAge({ age: 18 })?
  • What will be the result of the code: const x = (function() { return 2; })(); console.log(x);?
  • What is the primary difference between for ... of and for ... in when iterating over an array?
  • What will be the effect of using Object.freeze on an object?
  • What will be logged to the console when using the spread operator on an array?
  • What is a 'Promise' in JavaScript?
  • How do you properly inherit properties from a parent class in JavaScript?
  • What is the method for passing data from a parent component to a child component in LWC?
  • What will be the output of console.log(sofia.age) given the current prototype setting?
  • What is the primary function of JSON.parse?
  • What needs to be done to capture incoming JSON request data and parse it?
  • Which of the following correctly lists basic DOM data types?
  • What will the console output for the code: let array1 = ['one', 'two']; let array2 = ['three', 'four']; array1.push(...array2); console.log(...array1);?
  • What value does the eval function return when executing '10*10+5'?
  • What happens when a value is assigned to an index that exceeds the current length of the array?
  • What will be logged to the console from the given code snippet involving setTimeout?
  • What is logged when accessing a[b] after setting values for a[b] and a[c]?
  • What does the Promise.race method return when used with two promises?
  • Identify the falsy values from the listed options.
  • What will be the output of name.giveLydiaPizza() when the method is added to String.prototype?
  • Which of the following is a correct way to declare a constant in JavaScript?
  • Which lifecycle hook is used to initiate data retrieval in an LWC component?
  • What will be the result of the following code: class Animal { constructor(name) { this.name = name; } printName() { console.log(this.name); } } console.log(typeof Animal);?
  • What will be the outcome when executing the following code?
  • Which method is used to send data from a child component to a parent component in LWC?
  • What occurs when JavaScript hits a breakpoint during execution?
  • What is the output of the following code snippet?
  • How is a member function defined within a class in JavaScript?
  • Which of the following is true regarding asynchronous code in JavaScript?
  • What kind of scope does the `let` keyword provide for variables?
  • What does `this.template.querySelector()` allow a developer to do in Lightning Web Components (LWC)?
  • What does the await keyword do in JavaScript?
  • Given the code let num = 10; const increaseNumber = () => num++; const num1 = increaseNumber(); console.log(num1); What will be the output of num1?
  • What will the console output be after the following code executes: months.splice(1, 0, 'Feb') where months is ['Jan', 'March', 'April', 'June']?
  • What is a key characteristic of JavaScript's asynchronous programming model?
  • Which of the following is NOT a feature of Lightning Web Components?
  • How does JavaScript handle properties and methods for primitives, like strings?
  • Which event should a developer use to detect when the browser's native back or forward button is clicked?
  • In the provided code with obj and set, what is the output for obj.hasOwnProperty('1')?
  • What is the proper way to create a Promise that resolves after a delay?
  • How do you set a property to be read-only in an LWC?
  • What is the recommended way to handle user inputs in LWC?
  • How can the test be adjusted if the sum3 method is changed to multiply instead of add?
  • What does the 'renderedCallback' lifecycle hook do in LWC?
  • What is the Shadow DOM in relation to LWC?
  • What type will be returned when executing the sayHi function that returns an immediately invoked function expression?
  • How can you handle events in LWC?
  • Is it true that the JavaScript global execution context creates a global object and the "this" keyword?
  • What is the correct behavior when a property in an object is shadowed by a prototype property?
  • Which of the following is not an attribute of Object.defineProperty()?
  • Which choice correctly describes the effect of using Object.keys on a newly created object?
  • What is the output of the getPersonInfo function when called with tagged template literals?
  • What will the console output be when matching against the regex /[A-Z]/g in the string 'The quick brown fox jumps over the lazy dog. It barked.'?
  • What is a 'getter' in JavaScript?
  • What will the output be in the console for the statement console.log(x); let x = 10;?
  • What will be logged when executing the following code?
  • In which scenario is it preferable to use `let` instead of `var`?
  • What will be the output in the console for the following code: const months = ['Jan', 'March', 'April', 'June']; months.splice(3, 1, 'May'); console.log(months);?
  • Which of the following is a core feature of LWC?
  • What will the output of the for loop be when continue is used for i === 3?
  • How can you define a default value for a property in an LWC?
  • What action should be taken if a test still passes after a method update?
  • What type of function is an arrow function compared to regular functions?
  • What will checkAge({ age: 18 }) output?
  • What does the "this" keyword refer to in a JavaScript function?
  • What does typeof args return when calling getAge(21)?
  • What is the output of the given generator function code?
  • What is the advantage of using Salesforce's base Lightning components?
  • What method is used to navigate to another page in Salesforce from an LWC?
  • How do you resolve promises using async/await?
  • Which of the following is a valid way to create a Promise in JavaScript?
  • Which feature allows LWC components to handle multiple events?
  • What is the purpose of the popstate event in the History API?
  • What is the primary classification of all values in JavaScript?
  • What effect does an arrow function have on the 'this' keyword?
  • What is the output of the expression [...'Lydia'];?
  • What feature does 'lightning-button' offer in Lightning Web Component development?
  • What role do template directives play in LWC?
  • When using forEach with an array, what console output will be produced by the logArrayElements function defined as console.log('a[' + index + '] = ' + element)?
  • Which directive is used for conditional rendering in LWC?
  • What will the output be in the console for the statement console.log(x); var x = 10;?
  • For the code let message = { hello: 'Hello', names: ['Sue', 'Joe'], showMessage: function() { this.names.forEach(name => { console.log(this.hello + ' ' + name); }); } }; message.showMessage(); what will be the console output?
  • What is the main use of the `@wire` decorator in LWC?
  • What will happen if you try to reassign an exported constant variable in a module?
  • What is a common mistake when defining a function without the new keyword?
  • What is the output of sum(1, '2') in JavaScript?
  • What is the expected output when calling Object.values on an object?
  • Which option describes a situation when the npm install command would succeed but issue a warning?
  • Which statement about JavaScript modules is false?
  • What will be printed after executing the following code: const arr = [1, 2, 3]; arr.push(6); console.log(arr); arr.pop(); console.log(arr); arr.shift(); console.log(arr); arr.unshift(8); console.log(arr);?
  • When performing addition within JavaScript's reduce method, what can be expected as output?
  • What is the primary benefit of using the `import` keyword in JavaScript?
  • What properties does the `@wire` service return when querying for data?
  • When the innerDiv is clicked, in what order will the event listeners be called according to the provided code?
  • What does the let keyword allow in JavaScript?
  • How long will the data in sessionStorage remain accessible?
  • What does Object.keys return when called on an object?
  • What is the output of the following code: [[0, 1], [2, 3]].reduce((acc, cur) => { return acc.concat(cur); }, [1, 2]);?
  • In which scenario would the output of a console log differ based on when the variable is initialized?
  • What will be logged to the console with the following code: console.log(number++) and console.log(++number)?
  • What is the initial state of a promise created by the new Promise constructor?
  • What must you do to integrate LWC with other Salesforce components?
  • How can a developer handle errors when making asynchronous API calls in JavaScript?
  • How does the Pub/Sub model work in LWC?
  • What will be the console output when an error is thrown and caught in an immediately invoked function?
  • What is the output of the expression !!null; !!''; !!1;?
  • What will the console output be for console.log(eval(new String('2 + 2')))?
  • How do you define a custom event in LWC?
  • What can be inferred about properties defined using Object.create?
  • How does the 'super' keyword function in a class constructor?
  • What is the output of the following code: [1, 2, 3, 4].reduce((x, y) => console.log(x, y));?
  • What does the 'async' keyword signify in a function declaration?
  • What dictates that a function is a pure function?
  • What happens to the emp object's properties after calling Object.seal?
  • What will happen if you try to access a property of an undefined object?
  • How do you import a Lightning Component in an LWC?
  • What will be the order of output in the console based on the following code sequence?
  • What happens when a property is added to a function in JavaScript?
  • What is the primary tool for debugging LWC code?
  • What will be the output of the following code: let s_prim = 'foo'; let s_obj = new String(s_prim); console.log(typeof s_prim);?
  • What is the difference between `const`, `let`, and `var`?
  • What are the two most important fields in a package.json file for publishing npm packages?
  • What is a key characteristic of the Lightning Web Component architecture?
  • What is the main purpose of Lightning Web Components (LWC)?
  • Which property of an event object contains information about the target element that triggered the event?
  • What is the return type of methods defined in Lightning Web Components?
  • What will be logged to the console if a modified object is reused as a default parameter in a function call?
  • Which of these is NOT a valid way to execute promises p1 and p2?
  • What differentiates a function's prototype from an object's prototype?
  • What is the expected output for the following code: setTimeout(() => console.log('1'), 0); console.log('5');?
  • How do you handle user input in Lightning Web Components (LWC)?
  • What will be displayed in the console for the statement console.log(myDt + 10);?
  • Which of the following defines the lifecycle hooks of an LWC?
  • What is the purpose of the `Promise.all()` method?
  • How can elements' visibility be managed in LWC?
  • To alias msg1 as msg3 in the provided code import { msg2, msg1 } from './module2.js'; printMsg(msg1 + msg2);, which statement is correct?
  • What is the purpose of the import statement in JavaScript modules?
  • What are the two main properties of an error object passed to catch in a try...catch construct?
  • How can you manage multiple events in a single method in LWC?
  • What is the in-line command a developer can use to set a breakpoint in the code?
  • How can you make API calls in LWC?
  • When defining properties within a constructor, what is being created?
  • What will the output be for console.log(arr.reduce(reducer)) if arr is [1, 4, 9, 16]?
  • What is the output of the function getAge when 'use strict' is applied?
  • What does LWC stand for in Salesforce development?
  • What happens when a method defined with reduce is called without an initial accumulator value?
  • Which decorator is used to make a property reactive in LWC?
  • What is the purpose of the `@api` decorator in LWC?
  • How do you bind a JavaScript method to a specific object?
  • What is the correct syntax for defining a variable in JavaScript?
  • What will the output of console.log([1, 2][0]); be?
  • What will be the outcome of the following: let message = { hello: 'Hello', names: ['Sue', 'Joe'], showMessage: function() { this.names.forEach(function(name) { console.log(this.hello + ' ' + name); }); } }; message.showMessage();?
  • How many times does the fullName getter run with the provided student object?
  • In the for-in loop iterating over an object, what output will be produced from { name: 'Lydia', age: 21 }?
  • What is the purpose of `lightning-input` in LWC?
  • Which keyword is necessary for defining an asynchronous function in JavaScript?
  • In JavaScript, what does the method 'bind' do?
  • What types of items can events be attached to in a browser?
  • What is the result of the expression +true; !'Lydia';?
  • What can you use to communicate between parent and child components in LWC?
  • What happens when you call `Promise.all()` with an empty array?
  • How can you apply styles to an LWC component?
  • How can you prevent default form submission in JavaScript?
  • What does the following code snippet output: let message = { hello: 'Hello', names: ['Sue', 'Joe'], showMessage: function() { let self = this; this.names.forEach(function(name) { console.log(self.hello + ' ' + name); }); } }; message.showMessage();?
  • How can you create a reusable component in Lightning Web Components (LWC)?
  • What will the console log when executing: function showContact(firstName, lastName, ...titles) { console.log(firstName + ' ' + lastName + ', ' + titles[0] + ' and ' + titles[1]); } showContact('Sue', 'Johnson', 'Developer', 'Architect');?
Subscribe

Get the latest from Examzify

You can unsubscribe at any time. Read our privacy policy