What is a key difference between 'async/await' and traditional Promise-based code?
'async/await' is suitable for handling synchronous operations only.
'async/await' doesn't use Promises internally.
'async/await' is significantly slower than using Promises directly.
'async/await' provides a more synchronous-looking syntax for asynchronous code.
Which HTTP status code range generally indicates a successful request made with the Fetch API?
100-199
400-499
300-399
200-299
You want to remove the third child element from a parent element with the ID 'container'. What is the correct JavaScript code?
document.getElementById('container').childNodes[2].remove();
document.getElementById('container').deleteChild(2);
document.getElementById('container').removeChild(2);
document.getElementById('container').children[2].remove();
How does the 'bind()' method in JavaScript differ from 'call()' and 'apply()'?
bind() doesn't modify the original function, while call() and apply() do.
bind() can only be used with object methods, while call() and apply() can be used with any function.
bind() immediately invokes the function, while call() and apply() don't.
bind() creates a new function with a bound 'this' context, while call() and apply() invoke the function immediately.
What is the primary purpose of constructor functions in JavaScript?
To handle asynchronous operations.
To define private variables within a function scope.
To define static methods for a class.
To create multiple instances of an object with shared properties and methods.
How can you ensure that a piece of code runs only after a Promise has been rejected?
By placing the code immediately after the Promise is created.
By using the '.catch()' method.
By using the '.then()' method.
By using the 'setTimeout()' function.
In the context of ES6 classes, what is the purpose of the 'extends' keyword?
It extends the functionality of a built-in JavaScript object like Array or String.
It's used to create an instance of a parent class.
It defines a new static method within a class.
It establishes inheritance by creating a subclass that inherits properties and methods from a superclass.
What is a common practice to avoid deeply nested callbacks when working with multiple asynchronous operations?
Employing synchronous functions exclusively.
Using nested 'try...catch' blocks extensively.
Switching to a different programming language.
Chaining multiple '.then()' methods together.
What does the 'Fetch API' return as the result of a successful network request?
A Promise that resolves to a Response object.
A callback function for handling the response.
The requested data directly as a JavaScript object.
An error object indicating a failed request.
What is the purpose of the 'performance.now()' method in JavaScript?
It schedules a function to run after a specified delay.
It provides the current time in milliseconds since the Unix epoch.
It clears a timer previously set with 'setTimeout'.
It measures the execution time of a specific code block with high precision.