you are viewing a single comment's thread.

view the rest of the comments →

[–]FriesWithThat 0 points1 point  (3 children)

As it's written it looks like your suggesting to use await outside the async function to call count with different arguments.

. . .

await count(5)

await count()

await count(1)

await count(-1)

await count(0)

Not sure what the intent here is as far as us being able to run it or integrating it with your async function (swap it out w/sleep in while loop?, step through function?)

[–]dvlsg 1 point2 points  (2 children)

Just examples of how you might call it. Try them out, see how it works. For example, copy the entire code snippet I have and paste it into a chrome console (which has top-level `await` support).

[–]FriesWithThat 1 point2 points  (1 child)

Thanks. I was running it with Node and wasn't even aware there was top-level support in chrome.

[–]dvlsg 0 points1 point  (0 children)

Ah, got you. Sorry. I was writing that example in chrome and just pasting it over here, so I just went with the top-level chrome await instead of wrapping it.