From what i've scoured,to have line breaks in a given text using template literals just include a new line.But it seems not to work.
im trying to have a typewriting effect which it works well , but as soon as its starts display the characters it just goes horizontally.
How do i go about ?
input.addEventListener('keypress' , (e)=>{
if(e.key === 'Enter'){
input.style.display = 'none';
para.textContent ="";
let i=0;
let text =`Hi ${input.value},
welcome to my page.` //here i have include the line breaks but its not doing it
function changePara(){
if(i<text.length){
para.textContent += text.charAt(i);
i++;
setTimeout(changePara, 150);
}
}
changePara();