var election = 
  [
    {"region":"Alamosa", "value":  4},
    {"region":"Boulder", "value":  6},
    {"region":"Custer" , "value":  9},
    {"region":"Douglas", "value": 13},
    {"region":"Grand"  , "value": 18},
    {"region":"Jackson", "value": 24},
    {"region":"Mesa"   , "value": 31},
    {"region":"Pueblo" , "value": 40}
  ];

////////// v  code goes below v //////////

var maxValue = 0;
for (var i=0; i < election.length; i++) {
  if(election[i].value > maxValue) {
    maxValue = election[i].value;
  }
}

var x = d3.scale.linear()
    .domain([0, maxValue])
    .range([0, 420]);

d3.select(".bar-chart")
  .selectAll("div")
    .data(election)
  .enter().append("div")
    .style("width", function(d) { return x(d.value) + "px"; })
    .text(function(d) { return d.region; });
@@ -378,414 +378,4 @@
 //%0A%0A
-var maxValue = 0;%0Afor (var i=0; i %3C election.length; i++) %7B%0A  if(election%5Bi%5D.value %3E maxValue) %7B%0A    maxValue = election%5Bi%5D.value;%0A  %7D%0A%7D%0A%0Avar x = d3.scale.linear()%0A    .domain(%5B0, maxValue%5D)%0A    .range(%5B0, 420%5D);%0A%0Ad3.select(%22.bar-chart%22)%0A  .selectAll(%22div%22)%0A    .data(election)%0A  .enter().append(%22div%22)%0A    .style(%22width%22, function(d) %7B return x(d.value) + %22px%22; %7D)%0A    .text(function(d) %7B return d.region; %7D);

remove js code