sum-digit
v1.0.0
Published
Sum the digits of a number.
Downloads
2
Maintainers
Readme
sum-digit
Sum the digits of a number.
Features
Install
npm install --save sum-digit
Usage
const sumDigit = require('sum-digit');
sumDigit(123);
//=> 6
sumDigit(32581);
//=> 19
sumDigit('123');
//=> 6
sumDigit('123x');
//=> NaN
sumDigit(); // without parameter this function will throw a type error
//=> TypeError: expects Numeric value got undefined
Author
Prosen Ghosh [email protected] (https://bd.linkedin.com/in/prosen-ghosh-baba9aa8)
License
- MIT