{"size": 1068, "ext": "js", "max_stars_repo_path": "7-kyu/Decreasing Inputs/index.js", "max_stars_repo_name": "ayessetova/codeW", "max_stars_repo_stars_event_min_datetime": "2017-12-08T16:51:31.000Z", "max_stars_repo_stars_event_max_datetime": "2022-03-30T01:59:49.000Z", "max_issues_repo_path": "7-kyu/Decreasing Inputs/index.js", "max_issues_repo_name": "ayessetova/codeW", "max_issues_repo_issues_event_min_datetime": "2018-04-27T03:54:20.000Z", "max_issues_repo_issues_event_max_datetime": "2020-12-06T20:13:40.000Z", "max_forks_repo_path": "7-kyu/Decreasing Inputs/index.js", "max_forks_repo_name": "ayessetova/codeW", "max_forks_repo_forks_event_min_datetime": "2017-12-18T18:19:13.000Z", "max_forks_repo_forks_event_max_datetime": "2022-03-29T12:16:38.000Z"}
{"max_stars_count": 314, "max_issues_count": 4, "max_forks_count": 141, "avg_line_length": 27.3846153846, "max_line_length": 114, "alphanum_fraction": 0.6413857678}
/*
  Title:
    Decreasing Inputs

  Description:
    This kata is all about adding numbers.

    You will create a function named add. It will return the sum of all the arguments. Sounds easy, doesn't it?
    Well Here's the Twist. The inputs will gradually decrease with their index as parameter to the function.

    add(3,4,6); #returns ( 3 / 1 ) + ( 4 / 2 ) + ( 6 / 3 ) = 7

    add(3,4,6); #returns (3/1)+(4/2)+(6/3)=7

    add(3,4,6); #returns (3/1)+(4/2)+(6/3)=7

    Remember the function will return 0 if no arguments are passed and it must round the result if sum is a float.

  Examples:
    add(); //=> 0
    add(1,2,3); //=> 3
    add(1,4,-6,20); //=> 6

  Kata Link:
    https://www.codewars.com/kata/decreasing-inputs

  Discuss Link:
    https://www.codewars.com/kata/decreasing-inputs/discuss

  Solutions Link:
    https://www.codewars.com/kata/decreasing-inputs/solutions
*/

// Long Solution
const add = (...numbers) => Math.round(numbers.reduce((total, number, index) => total + number / (index + 1), 0))

// Function Export
module.exports = add
