/**
*
* Ashish Patel
* e: ashishsushilPatel@gmail.com
* w: https://ashish.me
*
*/
// You are given a two-digit integer n. Return the sum of its digits.
// Example
// For n = 29, the output should be addTwoDigits(n) = 11.
function addTwoDigits(values) {
const nums = values.toString().split('')
return nums.reduce((i, sum) => Number(i) + Number(sum))
}
test('add Two Digits', () => {
expect(addTwoDigits(29)).toEqual(11)
})
Created 2019-12-05T02:47:16+05:30 · Edit