MCPcopy Create free account
hub / github.com/asweigart/PythonStdioGames / slowSpacePrint

Function slowSpacePrint

javascript_games/magicfortuneball.js:14–26  ·  view source on GitHub ↗
(text, interval=0.1)

Source from the content-addressed store, hash-verified

12}
13
14async function slowSpacePrint(text, interval=0.1) {
15 for (let i = 0; i < text.length; i++) {
16 if (text[i] === 'I') {
17 // I's are displayed in lowercase for style:
18 process.stdout.write('i ');
19 } else {
20 // All other characters are displayed normally:
21 process.stdout.write(text[i] + ' ');
22 }
23 await sleep(interval);
24 }
25 console.log('\n'); // Print two newlines at the end.
26}
27
28
29async function main() {

Callers 1

mainFunction · 0.70

Calls 1

sleepFunction · 0.70

Tested by

no test coverage detected