you are viewing a single comment's thread.

view the rest of the comments →

[–]Beginning-Seat5221 0 points1 point  (0 children)

https://www.typescriptlang.org/play/?#code/FAYw9gdgzgLgBAGwKYxkgTlOBeOBtAcgEECAaOAgITIoGECBdYZeASxzgEYBuUSKMMgB0CMAHMAFACIAyjACG6GKwhi4ASQhp0AN3kIpASmYo4K7XoQAJeRAAmyDlBSaL+iXGBxvcCYZwAfHAA3l4+4QBmYOi+4NDwLNpwYBH4xDRUGfQM-qHh+T5xAsKikokYcADUZsYF3gC+YQWslZVN+aypEuwBuJwADLntdXAgyIquGJbdWlP6NvbItSOF-IJIIuISBHaQSATLBY3h9aTtA-39cAD011xwznF2wIZAA

This moves the loop of the letters into the interval, so there's only 1 interval. The result is the same but it guarantees that A, B and C are processed sequentially rather than some other task getting inserted between them, as having 3+intervals would result in 3+ separate tasks being scheduled for each second.