Add digits of a number using javascript

 console.log("add digits from a number");

 const addDigitsFromNumber = (num) => {
    let strNumber = num+'';
    let strArr = strNumber.split('');
    let total = 0;
    for (let i = 0; i < strArr.length; i++)
    {
         total += Math.abs(strArr[i]);
     }
 return (Math.abs(total));
 }
 console.log(addDigitsFromNumber(1234)); //10