Consider the code: const myFunc = (a, b) => a + b;. What type of function is myFunc?
const myFunc = (a, b) => a + b;
myFunc
Arrow function
Constructor function
Method
Generator function
In the context of ES6 classes, what is the purpose of the 'extends' keyword?
It's used to create an instance of a parent class.
It extends the functionality of a built-in JavaScript object like Array or String.
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 the purpose of the .catch() method in Promise chaining?
.catch()
To handle Promise rejections (errors).
To handle successful Promise resolutions.
To filter the results of a Promise.
To transform the resolved value of a Promise.
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.
How does the 'bind()' method in JavaScript differ from 'call()' and 'apply()'?
bind() creates a new function with a bound 'this' context, while call() and apply() invoke the function immediately.
bind() immediately invokes the function, while call() and apply() don't.
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.
What is the purpose of 'event.preventDefault()' in JavaScript?
It stops an event from being handled by any further listeners.
It triggers a custom event on an element.
It prevents the default behavior of an element, like a form submission.
It removes an event listener from an element.
What is the primary purpose of constructor functions in JavaScript?
To define static methods for a class.
To handle asynchronous operations.
To create multiple instances of an object with shared properties and methods.
To define private variables within a function scope.
Which method allows you to move up from a child element to its direct parent in the DOM?
previousSibling
closest()
parentElement
parentNode
Which tool is commonly used for profiling JavaScript code execution and identifying performance bottlenecks?
Chrome DevTools Performance Tab
JSON.stringify()
Array.reduce()
console.time()
In JavaScript's event loop, what is the role of the 'microtask queue'?
It handles user interactions like clicks and scrolls.
It executes tasks that have been explicitly delayed with setTimeout.
It processes promises and other tasks with higher priority than the main task queue.
It manages network requests and responses.