Last active
May 7, 2019 13:42
-
-
Save akagomez/38471ac9720a17b7546c to your computer and use it in GitHub Desktop.
Random todo generator
This file contains 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