Looking to convert two arrays into an object in JavaScript
let ar1 = ['jhon', 'doe', 'alex'];
let ar2 = ['21', '22', '35'];
The desired output should be:
obj=[
{name:'jhon',age:'21'},
{name:'doe', age:'22'},
{name:'alex', age:'35'}
]
Any tips on how to achieve this conversion?