My code seem to be working but I still get the following error:

Here is my functions.js

import { sleep } from "./helper.js";

const writeLog = async (message, delay, randomized) => {
    for (let i = 0; i < message.length; i++) {
        process.stdout.write(message[i]);
        if (randomized) {
            await sleep(Math.floor(Math.random() * delay));
        } else {
            await sleep(delay);
        }
    }
    process.stdout.write('\n');
}

export const funkylog = ({delay, randomized}) => {
    return (message) => {
        writeLog (message, delay, randomized);
    }
}

Please help.

  • Coderslang_Master replied to this.
  • hrusi You should either remove the curly braces or add another return keyword in front of writeLog here:

        return (message) => {
            writeLog (message, delay, randomized);
        }

    hrusi You should either remove the curly braces or add another return keyword in front of writeLog here:

        return (message) => {
            writeLog (message, delay, randomized);
        }
    Write a Reply...