I have a function that returns an array, how do I define the name of one of the columns in the return array with an argument?
Let's say instead of field 'qty' I want to have field whose name is passed in myFieldName argument.
var results = _.map(
    _.where(data, {
        UNDERLYING: product
    }),
    function (r) {
        if (r["QUANTITY"] != 0 && !isInArray(Date.parse(r["REPORT_DATE"]), errorDates)) {
            return {
                dt: Date.parse(r["REPORT_DATE"]),
                qty: (r["QUANTITY"] * multiplier)
            };
        }
    }
);
 
     
    