Question: i did this but it dosen't work function var Destination = [ {name: 'Chicago', Miles: 329, Gallons: 10.6}, {name: 'St.Louis', Miles: 284, Gallons: 10.5}, {name:

i did this but it dosen't work

function

var Destination = [ {name: 'Chicago', Miles: 329, Gallons: 10.6}, {name: 'St.Louis', Miles: 284, Gallons: 10.5}, {name: 'Indianapolis', Miles: 122, Gallons: 3.7}, {name: 'Nashville', Miles: 191, Gallons:6.4}, {name: 'Cincinnati', Miles: 132, Gallons: 3.9} ]; window.onload = function() { document.getElementById('showData').onclick = function() { tbl = document.getElementById("dataTable"); for( i=0 < Distination; i++) { var temp = parseFloat ( Destination[i].Miles) / paseFloat( Destination[i].Gallons); var MPG = ( temp ).toFixed(1); var row = document.createElement("tr"); var rowTxt = "" = Destination[i].name +"" rowTxt += "" + Destination[i].Miles / ""; rowTxt += "" + Destination[i].Gallons / "" + MPG + ""; row.innerHTML = rowTxt; tbl.appendChild(row); } }; };

Distination Data

DestinationMilesGallonMPG

it should show as this

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!