To handle multiple asynchronous tasks with Promises, the Promise._______ method is used, which runs multiple promises in parallel.

  • race
  • all
  • resolveAll
  • parallel
The correct option is 'all.' The Promise.all method is used to handle multiple asynchronous tasks with Promises by running multiple promises in parallel. It waits for all promises to resolve and returns an array of their results. The 'race' method resolves or rejects as soon as one of the promises in an iterable resolves or rejects.

Default parameters in a function are used when no argument or ________ is passed.

  • undefined
  • nan
  • nan
  • value
Default parameters in a function are used when no argument or undefined is passed. In JavaScript, if a parameter is not passed or is explicitly passed as undefined, the default value assigned to that parameter is used.

What is the key difference in loading dependencies in ES6 Modules compared to CommonJS?

  • Imports are hoisted in ES6 Modules
  • Synchronous loading in ES6 Modules
  • Asynchronous loading in ES6 Modules
  • No loading differences
In ES6 Modules, dependencies are loaded asynchronously, allowing for better performance and parallelism. This is in contrast to CommonJS, which loads modules synchronously.

How does the for...of loop interact with iterables in JavaScript?

  • The for...of loop automatically iterates over the values of an iterable, making it easier to work with collections like arrays and strings.
  • The for...of loop is used only with arrays and not with other iterables.
  • The for...of loop is an obsolete feature in JavaScript.
  • The for...of loop requires an explicit iterator method.
The for...of loop simplifies the process of iterating over iterables, providing a cleaner syntax compared to traditional for loops. It automatically calls the iterator's next() method and iterates until the done property becomes true.

What is the main purpose of an iterable in JavaScript ES6?

  • Iterables allow you to represent a sequence of values that can be iterated (looped) over.
  • Iterables are used for defining constants in JavaScript.
  • Iterables help in creating asynchronous functions.
  • Iterables provide a way to declare variables in JavaScript.
In JavaScript ES6, iterables are objects that implement the iterable protocol, allowing them to be looped over using the new for...of loop. They are crucial for working with collections of data, enabling efficient and concise iteration.

In a derived class, if you omit the constructor, JavaScript automatically calls super with _______.

  • Arguments of the derived class
  • Undefined
  • nan
  • Arguments of the parent class
If the derived class constructor is omitted, JavaScript implicitly adds one, calling super() with undefined as arguments. This ensures the parent class constructor is invoked.

When using Fetch API, the response of an AJAX call is first received in the _______ format.

  • JSON
  • Text
  • XML
  • Blob
The response of a Fetch API call is initially received in the Blob format. This allows flexibility in handling various types of data, such as images, text, or other binary data.

To handle multiple AJAX requests concurrently and wait for all to complete, use Promise._______.

  • all
  • race
  • any
  • chain
To handle multiple AJAX requests concurrently and wait for all to complete, use Promise.all(). This method takes an array of promises and waits until all of them are resolved or any one is rejected.

If you're building a function to fetch user data and then fetch related posts based on that data, how would you structure your Promise chain?

  • Nested Promises
  • Promise.all()
  • Promise.chain()
  • Async/Await
You would structure your Promise chain using nested promises. This involves chaining .then() handlers to ensure the sequence of asynchronous operations. This allows you to fetch user data first and then, based on that data, fetch related posts in a structured manner.

To ensure the uniqueness of a Symbol, it is created using Symbol(__________), where the argument is optional.

  • key'
  • id'
  • description'
  • optional'
In JavaScript, Symbols are used to create unique identifiers. The argument passed to Symbol() is optional and can be used to provide a description for debugging purposes. Example: const mySymbol = Symbol('This is a description');