Created
August 5, 2015 12:06
-
-
Save sanketmaru/9efaae6485d511294dd0 to your computer and use it in GitHub Desktop.
You want to build a word cloud, an infographic where the size of a word corresponds to how often it appears in the body of text.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var inputString = 'We came, we saw, we conquered...then we ate Bill\'s (Mille-Feuille) cake.' | |
function(inputString){ | |
var words = []; | |
for(var i=0;i<inputString.length;i++){ | |
var word = []; | |
var stringElem = inputString[i]; | |
word.push(stringElem); | |
if(stringElem === ' ' || stringElem === ',' ){ // marks the end of word | |
words.push(word); | |
continue; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment