Not sure what is wrong with my solution. It works in the terminal. But I am not able to submit.
solution.js
import { funkyLog } from './functions.js';
const message = `
Hello, world 👋!
Let's make our Console Output Fun and Interactive in JavaScript and Node.js 🚀
`;
const log = funkyLog({ delay: 100, randomized: true });
log(message);
functions.js
import { sleep } from './helper.js';
export const funkyLog = ({ delay, randomized }) => {
return async (s) => {
let randomTime;
for (let i = 0; i < s.length; i++) {
if (randomized) {
randomTime = Math.floor(Math.random() * delay);
}
process.stdout.write(s[i]);
await sleep(randomTime);
}
process.stdout.write('\n');
};
};
helper.js
export const sleep = (ms) =>
new Promise((resolve, reject) => {
setTimeout(() => {
resolve();
}, ms);
});
Please anybody help me 🙂