You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
29 lines
686 B
29 lines
686 B
console.log("loaded bro");
|
|
|
|
var Word = function () {
|
|
this.letters = [];
|
|
this.getLetters = function (newWord) {
|
|
var chars = newWord.split('');
|
|
for( var i = 0; i < chars.length; i++ ){
|
|
this.letters.push(new Letter(chars[i]));
|
|
}
|
|
};
|
|
this.isFound = function () {
|
|
return this.letters.every(function(currentLetter) {
|
|
return !currentLetter.hidden;
|
|
});
|
|
};
|
|
this.try = function (letter) {
|
|
for ( var i = 0; i < this.letters.length; i++ ) {
|
|
if ( this.letters[i].value === letter ) {
|
|
this.letters[i].show();
|
|
}
|
|
};
|
|
};
|
|
this.render = function () {
|
|
return this.letters.map( function(letter) {
|
|
return letter.render();
|
|
}).join('');
|
|
}
|
|
};
|