Code Sample

Here is some code:

// define the global variable
var sudoku, starttime, endtime, attempts;

// function that will later draw the sudoku
function drawsudoku() {
  "use strict";

  //define the local variables
  var i, totaltime;

  // loop through setting the numbers
  for (i = 0; i < sudoku.length; i += 1) {
    document.getElementById('sudoku').getElementsByTagName('input')[i].value = sudoku[i];   
  }

  // end the timer
  totaltime = (new Date().getTime() - starttime) / 1000;
  document.getElementById('info').innerHTML = attempts + " attempts " + totaltime + " seconds";
  starttime = 0;
  attempts = 0;
}