I want to have a type writer effect on my website. Such that it repeats the data in array infinite times not just once.

I tried to build one with JS but it's only showing data in the array only one time.

For example I have an array :

```
var dataText = [ "Amsterdam.", "Full Service.", "Webdevelopment.", "Vivank"];

```

I want it to be shown like this :

```
Amsterdam
Full Service.
Webdevelopment
Vivank

Amsterdam
Full Service.
Webdevelopment
Vivank

Amsterdam
Full Service.
Webdevelopment
Vivank.....

```

> 
> upto many times
> 
> 
> 

What my code is doing it stops after one cycle.
I want it to repeat cycle unlimited times.

Also, I am getting some kind of error.

> 
> Error:
>  { "message": "Script error.", "filename": "", "lineno": 0, "colno": 0 }
> 
> 
> 

Any Help?

Also how to add a pause to animation so that it starts to alter the text in `p` after a minute ?

Here is what i have tried so far :

```js
document.addEventListener('DOMContentLoaded',function(event){
  // array with texts to type in typewriter
  var dataText = [ "Amsterdam.", "Full Service.", "Webdevelopment.", "Vivank"];

  // type one text in the typwriter
  // keeps calling itself until the text is finished
  function typeWriter(text, i, fnCallback) {
    // chekc if text isn't finished yet
    if (i < (text.length)) {
      // add next character to h1
     document.querySelector("#tw").innerHTML = text.substring(0, i+1) +'<span aria-hidden="true"></span>';

      // wait for a while and call this function again for next character
      setTimeout(function() {
        typeWriter(text, i + 1, fnCallback)
      }, 100);
    }
    // text finished, call callback if there is a callback function
    else if (typeof fnCallback == 'function') {
      // call callback after timeout
      setTimeout(fnCallback, 700);
    }
  }
  // start a typewriter animation for a text in the dataText array
   function StartTextAnimation(i) {
     if (typeof dataText[i] == 'undefined'){
        setTimeout(function() {
          StartTextAnimation(0);
        }, 20000);
     }
     // check if dataText[i] exists
    if (i < dataText[i].length) {
      // text exists! start typewriter animation
     typeWriter(dataText[i], 0, function(){
       // after callback (and whole text has been animated), start next text
       StartTextAnimation(i + 1);
     });
    }

  }
  // start the text animation
  StartTextAnimation(0);
});
```

```html
<p id="tw">A</p>
```