Tengo dos matrices:
a1= ['All', 'one', 'two']; a2= ['Users', 'Service', 'Admin'];Necesito devolver una matriz de objetos como este
[ {value: 'All', label: 'Users'}, {value: 'one', label: 'Service'}, {value: 'two', label: 'Admin'} ]¿Alguien puede ayudar?
Prueba esto:
const a1 = ['All', 'one', 'two']; const a2 = ['Users', 'Service', 'Admin']; a1.map((item, index) => ({ value: item, label: a2[index] }))