dynamic array values convert into array of object in javascript

Solutions on MaxInterview for dynamic array values convert into array of object in javascript by the best coders in the world

showing results for - "dynamic array values convert into array of object in javascript"
Jessica
02 Sep 2020
1
2   <input type="text" name="header_key[]" class="form-control m-input" placeholder="Key" autocomplete="off">
3    <input type="text" name="header_val[]" class="form-control m-input" placeholder="Value" autocomplete="off"> 
4						
5					var obj_headers={}
6						var header_key = $("input[name='header_key[]']").map(function(){
7							return $(this).val();
8						}).get();
9						
10						var header_val = $("input[name='header_val[]']").map(function(){
11							return $(this).val();
12						}).get();
13						
14						for (var i = 0; i < header_key.length; i++) {
15							debugger;
16							obj_headers[header_key[i]] = header_val[i];
17						}