Dynamically create a table with values from an object
I rewrite in my style with only loop. It maybe easier to read.

perCurrency = {
  USD: { 0:100, 1:200, 2:9200, 3:1500, 4:1500 },
  CAD: { 0:250, 1:7600, 2:150, 3:3000 }
};
var numOfCurrency = Object.keys(perCurrency).length + 1;
var donation_table;
donation_table = $('&lt;table&gt;').attr('id', 'donation_table').addClass('table table-condensed'));

$.each(perCurrency, function(index, currency) {
  var lowestInCurrency  = Infinity,
      highestInCurrency = 0,
      totalInCurrency   = 0;
  $.each(currency, function(k, v){
    totalInCurrency = totalInCurrency + v;
    if (v &lt; lowestInCurrency) lowestInCurrency = v;
    if (v &gt; highestInCurrency) highestInCurrency = v;
  });

  donation_table.append(
    $('&lt;tr&gt;').append(
      $('&lt;td&gt;').css('font-weight', 'bold').css('width', '160px').html('&amp;nbsp;')
    ).append(
      $('&lt;td&gt;').css('width', '150px').text(index)
    )
  ).append(
    $('&lt;tr&gt;').append(
      $('&lt;td&gt;').css('font-weight', 'bold').css('width', '160px').text('Smallest Donation')
    ).append(
      $('&lt;td&gt;').text(lowestInCurrency)
    )
  ).append(
    $('&lt;tr&gt;').append(
      $('&lt;td&gt;').css('font-weight', 'bold').css('width', '160px').text('Largest Donation')
    ).append(
      $('&lt;td&gt;').text(highestInCurrency)
    )
  ).append(
    $('&lt;tr&gt;').append(
      $('&lt;td&gt;').attr('colspan', numOfCurrency).html('&amp;nbsp;')
    )
  ).append(
    $('&lt;tr&gt;').append(
      $('&lt;td&gt;').css('font-weight', 'bold').css('width', '160px').text('Total Donation')
    ).append(
      $('&lt;td&gt;').text(totalInCurrency)
    )
  );
});

$("#giving_capacity").html(donation_table);