Q: 11
Code:
01 let array = [1, 2, 3, 4, 4, 5, 4, 4];
02 for (let i = 0; i < array.length; i++) {
03 if (array[i] === 4) {
04
array.splice(i, 1);
05
i--;
06 }
07 }
What is the value of array after execution?
Options
Discussion
No comments yet. Be the first to comment.
Be respectful. No spam.
Q: 12
A developer is asked to fix some bugs reported by users. To do that, the developer adds a breakpoint
for debugging.
01 function Car(maxSpeed, color) {
02 this.maxSpeed = maxSpeed;
03 this.color = color;
04 }
05 let carSpeed = document.getElementById('carSpeed');
06 debugger;
07 let fourWheels = new Car(carSpeed.value, 'red');
When the code execution stops at the breakpoint on line 06, which two types of information are
available in the browser console?
Options
Discussion
No comments yet. Be the first to comment.
Be respectful. No spam.
Q: 13
Original code:
01 let requestPromise = client.getRequest;
03 requestPromise().then((response) => {
04 handleResponse(response);
05 });
The developer wants to gracefully handle errors from a Promise-based GET request.
Which code modification is correct?
Options
Discussion
No comments yet. Be the first to comment.
Be respectful. No spam.
Q: 14
Code:
01 const sayHello = (name) => {
02 console.log('Hello ', name);
03 };
04
05 const world = () => {
06 return 'World';
07 };
08
09 sayHello(world);
This does not print "Hello World".
What change is needed?
Options
Discussion
No comments yet. Be the first to comment.
Be respectful. No spam.
Q: 15
Which two implementations of utils.js support foo and bar?
Options
Discussion
No comments yet. Be the first to comment.
Be respectful. No spam.
Q: 16
Refer to the code below:
01 let timedFunction = () => {
02 console.log('Timer called.');
03 };
04
05 let timerId = setInterval(timedFunction, 1000);
Which statement allows a developer to cancel the scheduled timed function?
Options
Discussion
No comments yet. Be the first to comment.
Be respectful. No spam.
Q: 17
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?
Options
Discussion
No comments yet. Be the first to comment.
Be respectful. No spam.
Q: 18
Which option is true about the strict mode in imported modules?
Options
Discussion
No comments yet. Be the first to comment.
Be respectful. No spam.
Q: 19
A developer is creating a simple webpage with a button. When a user clicks this button for the first
time, a message is displayed.
The developer wrote the JavaScript code below, but something is missing. The message gets
displayed every time a user clicks the button, instead of just the first time.
01 function listen(event) {
02
03 alert('Hey! I am John Doe');
04
05 }
06 button.addEventListener('click', listen);
Which two code lines make this code work as required?
Options
Discussion
No comments yet. Be the first to comment.
Be respectful. No spam.
Question 11 of 20 · Page 2 / 2