javascript - Inserting custom text in JS output -


i have below line in js code. runs 0 2. want put custom text in place of: ' + info[i] + ' each of i's(over iterations of i). how do that?

for(var i=0; < origins.length-1; i++) {      var results = response.rows[i].elements;      output += '<tr><td>' + info[i] + '</td><td>' + origins[i] + '</td><td></td><td>' + destinations[i+1] + '</td><td></td><td>' + results[i+1].distance.text + '</td></tr>'; } 

. want put custom text in place of: ' + info[i] + ' each of i's(over iterations of i).

not sure "custom text" assume custom text should in array:

var customtext = ["custom text i=0",                   "custom text i=1",                   "custom text i=2"];  for(var i=0; < origins.length-1; i++) {      var results = response.rows[i].elements;      output += '<tr><td>' + customtext[i] + '</td><td>' + //.... } 

also how align out-put of code @ center of webpage?

this connected css rather js. use css property text-align: center table, div or wharever want center.


Comments

Popular posts from this blog

python - No exponential form of the z-axis in matplotlib-3D-plots -

php - Best Light server (Linux + Web server + Database) for Raspberry Pi -

c# - "Newtonsoft.Json.JsonSerializationException unable to find constructor to use for types" error when deserializing class -