I've an array with some values and I want to add a new element to this array.
I have an array like this:
arr1 = [
{'id': '1', 'data': 'data1'},
{'id': '2', 'data': 'data2'}
]
val = ['value1','value2']
and I want to add val array in arr1 and make a new array like this:
arr1 = [
{'id': '1', 'data': 'data1', 'val': 'value1'},
{'id': '2', 'data': 'data2', 'val': 'value2'}
]
How can I do that ?
I'm new to Javascript, so any type of help can be appreciated. Thank you!