@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?
n = int(input("Enter a positive integer to retrieve all the values of the Fibonacci series that correspond to this input : "))
def fib(n) :
v1 = 0
v2 = 1
while n > 0 :
for i in range(n):
v1,v2 = v2,v1+v2
print(v1, v2)
n-=1
fib(n)
@texirv0203 - these are some basics about how to make an object that you need to use for this hash / number counter.
var myObj = {}; // initialize an empty object
var anyNum = 8;
myObj[anyNum] = 1; // after this, the object should have an entry with a key of "8", value of "1"
myObj[anyNum]++; // after this, the object should have an entry with a key of "8", value of "2"
anyNum = 5;
myObj[anyNum] = 1; // after this, the object should still have the entry for "8" and a new entry with a key of "5", value of "1"
myObj[anyNum]++; // after this, the object should have an entry with a key of "5", value of "2"
if you take that code and experiment with it, for example in a browser devtools console, you can see what's happening. Or you can go to http://pythontutor.com/javascript.html and plug it in, and run it.
I have some questions but one question at a time.
In my CSS, the .navbar-brand img connects to my logo in the top left corner of my bootstrap navbar. Its off center in that corner. Does anyone know how to position the logo correctly? Let me know. Thanks
:star2: 3496 | @khaduch |http://www.freecodecamp.com/khaduch
<head>
section, but then the HTML section will be inserted into the output HTML code and probably conflict with your custom settings. By putting the external CSS in the CSS config panel, things get loaded in the proper order. You might be able to see what is going on if you load your page as it is now, and do a "View Frame Source" for the output panel.