Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function solve(arg) {
- const numArr = arg.toString().split('').map(Number);
- const firstDig = numArr[0];
- const isSame = numArr.every((num) => num === firstDig);
- const result = numArr.reduce((agrr, curnV) => agrr + curnV, 0);
- console.log(isSame);
- console.log(result);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement