{"size": 320, "ext": "js", "max_stars_repo_path": "easy/Add-Digits/add-digits.js", "max_stars_repo_name": "Lellansin/leetcode-questions", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "easy/Add-Digits/add-digits.js", "max_issues_repo_name": "Lellansin/leetcode-questions", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "easy/Add-Digits/add-digits.js", "max_forks_repo_name": "Lellansin/leetcode-questions", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": null, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 16.8421052632, "max_line_length": 49, "alphanum_fraction": 0.590625}
/**
 * @url https://leetcode.com/problems/add-digits/
 * @param {number} num
 * @return {number}
 */
var addDigits = function(num) {
	var str = num.toString(),
		result = 0;

	for (var i = 0; i < str.length; i++) {
		result += parseInt(str[i]);
	}

	if (result >= 10) {
		return addDigits(result);
	}
	return result;
};
