in the below code, activeProgs is an array contains program objects. i am using .map because i would like to have an array containing the name of the program and a token value. this token value is an integer and it could be incremented by one for each program as shown below in the code.
my question is, if i want to have the same array that contains the program name and the token but as an object. in other words, i want the .map() to return an array but that array contains objects with two attributes "progName" and "token". can i do the following?
activeProgs.map((prog)=> {progName: prog.getHeader().getName(), token: (++i)} )
please let me know how to do it correctly
code:
activeProgs.map((prog)=> prog.getHeader().getName() + '->' + (++i))