What does the 'Fetch API' return as the result of a successful network request?
The requested data directly as a JavaScript object.
A callback function for handling the response.
A Promise that resolves to a Response object.
An error object indicating a failed request.
What is the purpose of the 'performance.now()' method in JavaScript?
It measures the execution time of a specific code block with high precision.
It provides the current time in milliseconds since the Unix epoch.
It clears a timer previously set with 'setTimeout'.
It schedules a function to run after a specified delay.
Which of the following methods is used to handle errors within an 'async/await' function?
.then()
try...catch block
.catch()
.finally()
How can you ensure that the 'this' keyword inside a callback function refers to the intended object, especially in asynchronous operations?
By wrapping the callback function in another function.
By using arrow functions, which lexically inherit the 'this' value.
By invoking the callback function with 'call()' or 'apply()'.
By using the 'let' keyword to declare variables inside the callback.
Which tool is commonly used for profiling JavaScript code execution and identifying performance bottlenecks?
console.time()
Array.reduce()
Chrome DevTools Performance Tab
JSON.stringify()
Which technique can minimize DOM reflows and repaints, leading to smoother UI updates?
Using 'innerHTML' to update large sections of the DOM
Making changes to elements with 'display: none'
Batching DOM updates and using 'requestAnimationFrame'
Frequently reading element properties like 'offsetWidth'
Which built-in JavaScript method allows you to pass an array of arguments to a function, effectively spreading them as individual arguments?
call()
bind()
apply()
spread()
In the context of ES6 classes, what is the purpose of the 'extends' keyword?
It establishes inheritance by creating a subclass that inherits properties and methods from a superclass.
It extends the functionality of a built-in JavaScript object like Array or String.
It defines a new static method within a class.
It's used to create an instance of a parent class.
What is the purpose of 'event.preventDefault()' in JavaScript?
It stops an event from being handled by any further listeners.
It prevents the default behavior of an element, like a form submission.
It removes an event listener from an element.
It triggers a custom event on an element.
What is the impact of long-running JavaScript tasks on the browser's responsiveness?
They enhance user experience by providing smoother animations and transitions.
They can block the main thread, leading to a frozen UI and unresponsive interactions.
They have no significant impact on browser responsiveness, as JavaScript execution is asynchronous.
They improve rendering performance by allowing the browser to optimize resource allocation.