I am trying to get all Ids of the company Users and add it to the int array:
userListIds: state.ddls.companyUsers.forEach(function (element) {
---How to add it to the int array
});
Thanks in advance.
I am trying to get all Ids of the company Users and add it to the int array:
userListIds: state.ddls.companyUsers.forEach(function (element) {
---How to add it to the int array
});
Thanks in advance.
use map
userListIds: state.ddls.companyUsers.map(function (element) {
return element.id
});
It does the same from @aseferov but its written in ES6:
userListIds: state.ddls.companyUsers.map(element => element.id);