//sample solution for Hangman Exercise 1
// This array holds the words we are going to choose from.
// Feel free to add new words!
var words = ['cat', 'tree', 'swing', 'around', 'scientist'];
// This function will pick our word
function chooseWord (words) {
// Write code here
var index = parseInt(Math.random()*words.length);
return words[index];
}
//for testing purposes
console.log(chooseWord(words));
No comments:
Post a Comment