Linked Questions

9 votes
5 answers
27k views

"bills": [ { "refNo": 17, "billDate": "1-apr-2016", "dueDate": "30-apr-2016", "pendingAmount": ...
Avijit Dutta's user avatar
  • 3,881
2 votes
2 answers
3k views

Is it possible to add up all duration values of an object array without iteration? const data = [ { duration: 10 any: 'other fields' }, { duration: 20 any: 'other fields' } ] ...
user3142695's user avatar
  • 17.5k
2 votes
2 answers
2k views

I know I can use reduce to sum the numbers of an array, like so: let numArray = [1, 2, 3, 4].reduce((a, b) => a + b, 0); console.log(numArray); However, if I have an array of objects, of which one ...
Muirik's user avatar
  • 6,349
0 votes
4 answers
2k views

Below is a sample array of objects : [{Name : Deji, Age: 12}, {Name : Sonia, Age 13}, {Name : Fabio, Age: 21}] How do I iterate through the arrays in such a way as to add up the ages of the people in ...
Deji James's user avatar
0 votes
3 answers
1k views

I'm learning the reduce method and I am trying to use it on this array of objects but i cant seem to figure it out here. the objective is to add all of the age elements together, I can do it with a ...
Robert Rodriguez's user avatar
-2 votes
2 answers
1k views

I have a shopping cart in one of my projects about e-commerces, and I want to show in the side of the cart icon the number of items on it. There's so many ways to make it, but honestly my brain is so ...
Alan's user avatar
  • 47
0 votes
1 answer
564 views

I have the following array object [{ count: 2, created_data: "2022 07 19" }, { count: 4, created_data: "2022 07 19" }, { count: 4, created_data: "2022 07 19" }, { ...
Alkari's user avatar
  • 116
0 votes
2 answers
1k views

function dialogController(generate, $scope) { $scope.profiles = generate.get_keys('::role'); $scope.content = {}; $scope.options = []; $scope.servers = {}; $scope.subs = {}; $scope.discountList = {}; $...
Padhy Akash's user avatar
-1 votes
4 answers
129 views

I'm using Javascript, and I have an array like this: counters: [ { id: 1, value: 0 }, { id: 2, value: 10 }, { id: 3, value: 5 }, { id: 4, value: 3 } ] I want to get a ...
David TG's user avatar
0 votes
3 answers
699 views

Goal: Display the total sum of all id value after the text "Total sum of all id value is:" The id value is from the API data. Problem: I do not know how to do it and is it possible to do it? ...
HelloWorld1's user avatar
  • 14.2k
1 vote
1 answer
675 views

I am trying to get an object as output using JavaScript reduce function. It's working, if I define an object {ageTotal: 0} as the second argument. How can I implement this sum of age without defining ...
Mamunur Rashid's user avatar
0 votes
1 answer
468 views

I have an array: const expenses = [ { key: '1', sum: '100', category: 'car' }, { key: '2', sum: '200', category: 'food'}, { key: '3', sum: '300', category: 'furniture'}, ...
Champion's user avatar
  • 774
0 votes
6 answers
489 views

I parsed data to a variable var Mydata = [ { count: 4, min: 0, max: 0, mean: 0, ID: 1 }, { count: 12, min: 0, max: 0, mean: 0, ID: 2 }, { count: ...
Rachit Vyas's user avatar
0 votes
2 answers
439 views

The problem was: const arr = [ { name1: 'value1', qty: 1, time: 1 }, { name1: 'value2', qty: 1, time: 2 }, ]; // using this reducer works! const reducer = (acc, { name1, qty}) => { const ...
Noriller's user avatar
  • 370
-1 votes
1 answer
73 views

This is my response data: var data = [{ 'name': 'ragu', 'taxprice': '20' } { 'name': 'ram', 'taxprice': '20' } {...
user avatar

15 30 50 per page
1
2 3 4 5