I have an Object array:
let products = [{ code: 'a', num: 1 }, { code: 'b', num: 2 }];
I want to get the codes array: ['a', 'b'].
This is how I am doing now using lodash:
let codes = [];
_.forEach(products, (product) => {
codes.push(product.code);
});
Is there any smart way to do this?