function typewriterEffect(text, delay = 100) {
let i = 0;
function typeWriter() {
if (i < text.length) {
process.stdout.write(text.charAt(i));
i++;
setTimeout(typeWriter, delay);
} else {
process.stdout.write('\n'); // Move to the next line after the text is printed
}
}
typeWriter();
}
// Example usage
const textToPrint = "Hello, this is a typewriter effect!";
typewriterEffect(textToPrint, 50); // Adjust the delay as needed