Getting Wrong Output When Trying To Loop Through The First 50 Even Fibonacci Numbers In Javascript
I am new to JavaScript and am having trouble getting my code to work. Any help/guidance is greatly appreciated. I am getting the wrong output (currently “9.715575428267785e+30�
Solution 1:
I disagree with the people saying this is a duplicate because I think the real question you are asking is "how do I debug my failing program?" I am sure that must be a duplicate too but, well, hem...
Anyhow I think what would help you a lot here is console.log(). I don't know what browser you are using but all major ones have a JS console. (I recommend Firefox with Firebug.) Add lines like:
console.log('integer for '+ loopFib +'='+integer);
Or
console.log('display=' + display);
To the relevant points in your script. Then open your browser's JavaScript console to view the results. I already see some major boners in your code but I'm not going to correct them for you - this is your homework assignment after all and I'd rather teach a man to fish. Comment on this reply if you have any more questions.
Post a Comment for "Getting Wrong Output When Trying To Loop Through The First 50 Even Fibonacci Numbers In Javascript"