I try to create a typeWriter effect using Javascript. It done perfectly, but it cannot type '<' character. I don't know how to fix it
My code is:
let other = document.getElementById('other');let txt = "Hello World <br> this typing effect.";let i = 0;function typeWriter() { if (i < txt.length) { other.innerHTML += txt.charAt(i); i++; setTimeout(typeWriter, 10); window.scrollTo(0, document.body.scrollHeight); }}typeWriter();
<h1 id='other'></h1>
I hope the result like:
Hello Worldthis typing effect.
Actual result I get:
Hello World <br> this typing effect.
Please give me some clue. Thanks in advance