Test Yourself: Business Logic

Test your skills on how to handle business logic.

We'll cover the following...

Choose the correct answer(s)

1.

What is the best description for the behavior of the following code?

for await (const line of readInterface) {
    const correctedLine = line
      .split(" ")
      .map((word) => {
        if (SpellChecker.isMisspelled(word)) {
          const suggestions = SpellChecker.getCorrectionsForMisspelling(word);

          const matches = stringSimilarity.findBestMatch(word, suggestions);

          return matches.bestMatch.target;
        } else return word;
      })
      .join(" ");

    text += correctedLine + "\n";
  }
A.

The for await...of statement creates a loop that iterates over async iterable objects of readline only.

B.

The for await...of statement creates a loop that iterates over async iterable objects only.

C.

The for await...of statement can be used to iterate over both objects and primitive values.

D.

The for await...of statement creates a loop that iterates over async iterable objects as well as over sync iterables.


1 / 5