| Exam Code/Number: | JS-Dev-101Join the discussion |
| Exam Name: | Salesforce Certified JavaScript Developer - Multiple Choice |
| Certification: | Salesforce |
| Question Number: | 149 |
| Publish Date: | Dec 01, 2026 |
|
Rating
100%
|
|
A developer wants to set up a secure web server with Node.js. The developer creates a directory locally called app-server, and the first file is app-server/index.js.
Without using any third-party libraries, what should the developer add to index.js to create the secure web server?
Refer to the code below:
01 const myFunction = arr => {
02 return arr.reduce((result, current) => {
03 return result + current;
04 }, 10);
05 }
What is the output of this function when called with an empty array?
A Node.js server library uses events and callbacks. The developer wants to log any issues the server has at boot time.
Which code logs an error with an event?
Which statement accurately describes the behavior of the async/await keywords?
A developer creates a simple webpage with an input field. When a user enters text and clicks the button, the actual value must be displayed in the console:
HTML:
<input type="text" value="Hello" name="input">
<button type="button">Display</button>
JavaScript:
01 const button = document.querySelector('button');
02 button.addEventListener('click', () => {
03 const input = document.querySelector('input');
04 console.log(input.getAttribute('value'));
05 });
When the user clicks the button, the output is always "Hello".
What needs to be done to make this code work as expected?