From 371ac32c7ceba480f4c7f331dcb708a27de65ec0 Mon Sep 17 00:00:00 2001 From: Meghav Mehta Date: Mon, 30 Mar 2015 15:49:26 -0700 Subject: [PATCH] its working --- index.html | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/index.html b/index.html index b3625db..7a4ca82 100644 --- a/index.html +++ b/index.html @@ -32,10 +32,21 @@ function updateText() { - el.innerHTML = el.innerHTML+words[word_counter][character_counter++]; + var letter = words[word_counter][character_counter++]; + - if(character_counter == words[word_counter].length) + if (letter === " ") { + + letter = " "; + } + console.log(letter) + el.innerHTML += letter; + + + if(character_counter == words[word_counter].length+1) + { + word_counter++; //choose a different word character_counter = 0; //start over with the first character of the word el.innerHTML = ''; //set the html to be blank