How can i use parseFloat when data lives inside of an array?
Let's say that i get an api response like this:
$scope.response = [{name: "Richard", qty: "350.99"},
{name: "Chuck", qty: "199"},
{name: "Phonenix", qty: "233.77"}]
I want to sum the values of qty, but i cannot 'cause the data type. If i need to use parseFloat over qty, how can i get only those values?
I have to use something like some() to get qty values?
I'm using AngularJs and Javascript.
reduceit to return a sum.$scope.response.reduce((a,b) => a + parseFloat(b.qty));,0);