79615547

Date: 2025-05-10 14:07:24
Score: 1
Natty:
Report link

Here is the solution in Javascript

const str='I am 25 years and 10 months old';
let count=0;
let sum=0;
for(let i=0; i<str.length; i++){
  if(str[i]!=' ' && !isNaN(str[i])){
    sum+=str[i]-0;
    count++;
  }
}

console.log(`sum: ${sum}, Avg: ${sum/count}`);
Reasons:
  • Low length (0.5):
  • Has code block (-0.5):
  • Low reputation (1):
Posted by: Nitesh Kumar Sharma