I believe that in a bubble sort, once the i loop has completed an iteration, then the i'th element is now in its correct position. That means that you should write the j loop as
for (var j = i + 1; j < records.length; j++)
Otherwise your bubble sort will be (even more) inefficient.