-
-
Save bhubr/9e2cfb256fd6c5731cc99bad3d672fe2 to your computer and use it in GitHub Desktop.
Random todo generator
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
(function () { | |
var actions = 'call,read,dress,buy,ring,hop,skip,jump,look,rob,find,fly,go,ask,raise,search'; | |
var bridges = 'the,a,an,my,as,by,to,in,on,with'; | |
var targets = 'dog,doctor,store,dance,jig,friend,enemy,business,bull,Monday,Tuesday,Wednesday,Thursday,Friday,Saturday,Sunday,Mom,Dad'; | |
var capitalizeFirstLetter = function(string) { | |
return string.charAt(0).toUpperCase() + string.slice(1); | |
} | |
var randomWord = function (list) { | |
list = list.split(','); | |
return list[Math.floor(Math.random() * list.length)]; | |
} | |
window.generateRandomTodo = function () { | |
return capitalizeFirstLetter(randomWord(actions)) + ' ' + | |
randomWord(bridges) + ' ' + randomWord(targets); | |
} | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment