function deleteWord() {
  // Get substring with 1 characater deleted
  var displayedText =  PAGE_PHRASES[currrentPhrase].substring(0, letterIndex - 1);
  element.innerText = displayedText;
  letterIndex--;

  // If sentence has been deleted then start to display the next sentence
  if(displayedText === '') {
    clearInterval(interval);

    // If current sentence was last then display the first one, else move to the next
    if(currrentPhrase== (PAGE_PHRASES.length - 1))
        currrentPhrase= 0;
    else
        currrentPhrase++;
    
    letterIndex = 0;

    // Start to display the next sentence after some time
    setTimeout(function() {
        cursor.style.display = 'inline-block';
        interval = setInterval(typeWord, 130);
    }, 200);
  }
}
/**
 * Function which implements the deleting effect for the typing animation.
 */
Function which implements the deleting effect for the typing animation.
Function which implements the deleting effect for the typing animation .
function deleteWord() {
  var displayedText =  PAGE_PHRASES[currrentPhrase].substring(0, letterIndex - 1);
  element.innerText = displayedText;
  letterIndex--;
  if(displayedText === '') {
    clearInterval(interval);
    if(currrentPhrase== (PAGE_PHRASES.length - 1))
        currrentPhrase= 0;
    else
        currrentPhrase++;
    letterIndex = 0;
    setTimeout(function() {
        cursor.style.display = 'inline-block';
        interval = setInterval(typeWord, 130);
    }, 200);
  }
}
function deleteWord ( ) { var displayedText = PAGE_PHRASES [ currrentPhrase ] . substring ( 0 , letterIndex - 1 ) ; element . innerText = displayedText ; letterIndex -- ; if ( displayedText === '' ) { clearInterval ( interval ) ; if ( currrentPhrase == ( PAGE_PHRASES . length - 1 ) ) currrentPhrase = 0 ; else currrentPhrase ++ ; letterIndex = 0 ; setTimeout ( function ( ) { cursor . style . display = 'inline-block' ; interval = setInterval ( typeWord , 130 ) ; } , 200 ) ; } }
Function which implements the deleting effect for the typing animation.
Function which implements the deleting effect for the typing animation .
// Get substring with 1 characater deleted // If sentence has been deleted then start to display the next sentence // If current sentence was last then display the first one, else move to the next // Start to display the next sentence after some time