JSFiddle - React, Tailwind, and code Playground

by Kai

JavaScript

/**
 * Game constructor
 */
function Game () {
    this.current = '';
    this.words = ['Kai', 'Khary', 'Keith'];
    this.stats = {
        guesses: 0,
        correct: 0,
        incorrect: 0,
        fastest: {
            word: '',
            time: 0.0
        },
        slowest: {
            word: '',
            time: 0.0
        },
        longest: {
            word: '',
            time: 0.0
        },
        shortest: {
            word: '',
            time: 0.0
        }
    };
}

Game.prototype.start = function () {
    
    while(this.current = this.next()) {
        
        console.log(this.current);
        
        this.updateStats();
    }
    
};

Game.prototype.next = function () {
    return this.words.shift();
};

Game.prototype.updateStats = function () {};
    
var g = new Game();
g.start();