Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
Counting digits
//nodejs v4.2.6 function count_digits(number) { number = "" + number; var obj = {}; for(var digit of number) { if(obj[digit]) { obj[digit] += 1; } else { obj[digit] = 1; } } return obj; } var n = 141157656072; console.log(count_digits(n)); console.log(JSON.stringify(count_digits(675436550467), undefined, 4));
run
|
edit
|
history
|
help
0
lodash
neural spam network
Add property to object
Include object in a query string
Count digits
find all prime factors of a number
horsevalue
Find the missing number in array
Funny stuff
problem_name