jQuery Multidimensional Array (dynamic key) - Cannot set property of undefined
<p>Thanks you Chad for his solution, however it now appears to clear values from the array, here is a <code>foreach</code> on the console log which shows you my situation (followed by the updated code for the update function):</p>

<pre><code>timer.html:60 ------------------------------------
timer.html:57 0
timer.html:58 undefined
timer.html:57 1
timer.html:58 1.910
2timer.html:60 ------------------------------------
timer.html:57 0
timer.html:58 undefined
timer.html:57 1
timer.html:58 undefined
timer.html:57 2
timer.html:58 1.727
2timer.html:60 ------------------------------------
timer.html:57 0
timer.html:58 undefined
timer.html:57 1
timer.html:58 undefined
timer.html:57 2
timer.html:58 undefined
timer.html:57 3
timer.html:58 0.690
timer.html:60 ------------------------------------
</code></pre>

<p>=============================================</p>

<pre><code>function updateLap(kartId){

  if (isNaN(driverLapNumber[kartId])) {
     //IF LAP NOT SET THEN THE KART ID NEEDS TO BE SET AS 0 AS IT IS THE START OF THE RACE
     window.driverLapNumber[kartId] = 0;  
  }

  //ADD ONE LAP TO THE KART ID
  driverLapNumber[kartId]++;

  //ADD LAP TIME FOR CURRENT LAP NUMBER  
  driverLapTimes[kartId] = [];
  driverLapTimes[kartId][driverLapNumber[kartId]] = window.lapTime;

   $.each(driverLapTimes , function( index, obj ) {
    $.each(obj, function( key, value ) {
        console.log(key);
        console.log(value);     
    });
    console.log("------------------------------------");
  });


  $(".lapTimes").prepend("kartId: "+kartId+" - "+window.lapTime+"&lt;br&gt;");

}
</code></pre>

<hr>

<p>I suppose I can blame PHP for this as it would be possible with the way I am writing it currently, I need assistance in correcting this please.</p>

<p>Everything is fine except for the SECOND key on the <code>driverLapTimes</code> array, I want it to output something like:</p>

<pre><code>driverLapNumber[999][1] = 6.666;
driverLapNumber[999][2] = 6.666;
driverLapNumber[999][3] = 6.666;
driverLapNumber[999][4] = 6.666;
</code></pre>

<p>But the 1,2,3,4 keys are coming up with the following console error:</p>

<blockquote>
  <p>Uncaught TypeError: Cannot set property '1' of undefined</p>
</blockquote>

<p>The function code:</p>

<pre><code>function updateLap(kartId){

  if (isNaN(driverLapNumber[kartId])) {
     window.driverLapNumber[kartId] = 0;  
  }

  //ADD ONE LAP TO THE KART ID
  driverLapNumber[kartId]++;

  //ADD LAP TIME FOR CURRENT LAP NUMBER
  driverLapTimes[kartId][driverLapNumber[kartId]] = window.lapTime;  

}
</code></pre>