:cookie: 331 | @kevinkiklee |http://www.freecodecamp.com/kevinkiklee
background-image
in css to the element
@texirv0203 - it was to convert a value that is a number to a string, then split it. That gives you access to an array of the individual digits.
var num = 33767999;
num.toString().split('').forEach(
// you write a function here
);
the function within the .forEach()
method would be able to access the individual elements of the array, and build the hash in an object.
@texirv0203 - in this context, I would say that you need to make this "hash" as an object. Each key/value pair in the object will be a key consisting of one of the digit values in the string, and the value would be the number of times that it occurs in the number. So you would want to end up with an object, for your example digit string, that looks like this:
{3: 2, 6: 1, 7: 2, 9: 3}
3: 2
6: 1
7: 2
9: 3
Are you familiar with creating objects in javascript?