function main() {

    // Remove all click bindings.
    cleanupBoard();

    // Reset all variables.
    i = 0;
    nGuesses = 1;
    guess = [0, 0, 0, 0];
    num = pickNum(len);

    // Empty the anwer window and add 0s.
    $("#answer").empty();
    for (var j = 0; j < len; j ++ ) {
        $("#answer").append("\<a href\=\"#\" class\=\"" + (j + 1) + " game-board btn btn-primary\"\>0\<\/a\>");
    }

    // Remove old data from HTML page.
    $(".game-board").empty().append(0);
    $("#score").children().remove();
    for (var j = 0; j < 4; j ++ ) {
        $("#score").append("\<a href=\"#\" class=\"list-group-item disabled\"\>&nbsp;\<\/a\>");
    }

    // Debug messages. Should not be in production.
    console.log('Length of Number: ' + len);
    console.log('The secret number is:  ' + num.join(',  '));
    console.log('Max guesses allowed: ' + maxGuesses);

    // Initialize all buttons and game-board again.
    initBoard();
}
/* Initial game and page conditions.
 * - Resets all variables.
 * - Clears the main number display.
 * - Clears previous entries.
 * ------------------------------------------------------------------------- */
Initial game and page conditions.
- Resets all variables.
- Clears the main number display.
- Clears previous entries.
Initial game and page conditions . - Resets all variables . - Clears the main number display . - Clears previous entries .
function main() {
    cleanupBoard();
    i = 0;
    nGuesses = 1;
    guess = [0, 0, 0, 0];
    num = pickNum(len);
    $("#answer").empty();
    for (var j = 0; j < len; j ++ ) {
        $("#answer").append("\<a href\=\"#\" class\=\"" + (j + 1) + " game-board btn btn-primary\"\>0\<\/a\>");
    }
    $(".game-board").empty().append(0);
    $("#score").children().remove();
    for (var j = 0; j < 4; j ++ ) {
        $("#score").append("\<a href=\"#\" class=\"list-group-item disabled\"\>&nbsp;\<\/a\>");
    }
    console.log('Length of Number: ' + len);
    console.log('The secret number is:  ' + num.join(',  '));
    console.log('Max guesses allowed: ' + maxGuesses);
    initBoard();
}
function main ( ) { cleanupBoard ( ) ; i = 0 ; nGuesses = 1 ; guess = [ 0 , 0 , 0 , 0 ] ; num = pickNum ( len ) ; $ ( "#answer" ) . empty ( ) ; for ( var j = 0 ; j < len ; j ++ ) { $ ( "#answer" ) . append ( "\<a href\=\"#\" class\=\"" + ( j + 1 ) + " game-board btn btn-primary\"\>0\<\/a\>" ) ; } $ ( ".game-board" ) . empty ( ) . append ( 0 ) ; $ ( "#score" ) . children ( ) . remove ( ) ; for ( var j = 0 ; j < 4 ; j ++ ) { $ ( "#score" ) . append ( "\<a href=\"#\" class=\"list-group-item disabled\"\>&nbsp;\<\/a\>" ) ; } console . log ( 'Length of Number: ' + len ) ; console . log ( 'The secret number is:  ' + num . join ( ',  ' ) ) ; console . log ( 'Max guesses allowed: ' + maxGuesses ) ; initBoard ( ) ; }
Initial game and page conditions.
Initial game and page conditions .
// Remove all click bindings. // Reset all variables. // Empty the anwer window and add 0s. // Remove old data from HTML page. // Debug messages. Should not be in production. // Initialize all buttons and game-board again.