×

Welcome to TagMyCode

Please login or create account to add a snippet.
0
0
 
0
Language: Javascript
Posted by: Andy Savela
Added: Jul 5, 2022 5:14 PM
Views: 6
Tags: no tags
  1. const getAges = (data: Array<Animal>): number => {
  2.     let sumOfAges = 0;
  3.     for (var i = 0; i < data.length; i++) {
  4.         console.log(data[i].age);
  5.         sumOfAges += (data[i].age * 7);
  6.     }
  7.     return sumOfAges;
  8. }