I have a form that has eight input types
<input type="text" name="name0" class="form-control" id="name0">
<input type="text" name="address0" class="form-control" id="address0">
<hr>
<input type="text" name="name1" class="form-control" id="name1">
<input type="text" name="address1" class="form-control" id="address1">
<hr>
<input type="text" name="name2" class="form-control" id="name2">
<input type="text" name="address2" class="form-control" id="address2">
<hr>
<input type="text" name="name3" class="form-control" id="name3">
<input type="text" name="address3" class="form-control" id="address3">
I am now trying to prefill the values of the form using the array
info = [{name:"Tom", address:"abc street"},{name:"Lois", address:"abc street"},{name:"Cale", address:"abc street"},{name:"Bob", address:"abc street"}];
in javascript. The order that appears on the array is the order the input type get populated.
What I have tried:
I started with a for loop
for( let k of info)
{
}
In the past I have been able to filter through the array when all (key:values) were different but I am having trouble distinguishing and filtering it out for this case. Open to any help if possible.