JSFiddle - React, Tailwind, and code Playground

by Vivid D

HTML

<div id="writer"></div>

CSS

#writer{ 
    border: 1px solid black; 
    width:300px; 
    min-height: 200px;
    margin: auto;
}

JavaScript

var text = "Hello World! I'm some typed text!";
var counter = 0;
var speed = 200;

function type(){
    lastText = document.getElementById("writer").innerHTML;
    lastText+=text.charAt(counter);
    counter++;
    document.getElementById("writer").innerHTML = lastText;
}

setInterval(function(){type()},speed);