Generating Fibonacci Sequence

0 votes
var x = 0;
var y = 1;
var z;

fib[0] = 0;
fib[1] = 1;

for (i = 2; i <= 10; i++) {
  alert(x + y);
  fib[i] = x + y;
  x = y;
  z = y;
}

I'm attempting to produce a basic Fibonacci sequence, but there is no output.

Could someone please tell me what's wrong?

Nov 17 in Java by Nicholas
• 7,120 points
29 views

No answer to this question. Be the first to respond.

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.

Related Questions In Java

0 votes
1 answer

Generating an MD5 hash?

The MessageDigest class can provide you with an instance ...READ MORE

answered Jun 13, 2018 in Java by Rishabh
• 3,620 points
716 views
0 votes
1 answer

Generate 10 fibonacci numbers.

The placement of logic is wrong that ...READ MORE

answered Nov 21, 2018 in Java by Nabarupa
564 views
0 votes
0 answers

Generating PDF files with JavaScript

I was hoped that I could accomplish ...READ MORE

Sep 28 in Java by Nicholas
• 7,120 points
67 views
0 votes
0 answers

Generating random whole numbers in JavaScript in a specific range

How can I create random whole numbers ...READ MORE

Sep 28 in Java by Nicholas
• 7,120 points
93 views
0 votes
1 answer

Presenting docket dtates inside html page by javascript

Use the Docker Engine Api:Docker Engine API ...READ MORE

answered Jun 20, 2018 in Docker by DareDev
• 6,890 points
256 views
0 votes
1 answer

Migrating proxy npm repo in nexus 3

I don't think you can achieve this ...READ MORE

answered Jun 22, 2018 in DevOps Tools by DareDev
• 6,890 points
885 views
+1 vote
1 answer

What is the difference between JavaScript and Java

This quote rightly explains that 2 totally ...READ MORE

answered Jun 29, 2018 in Java by Daisy
• 8,120 points
280 views
+1 vote
1 answer

How to write the Fibonacci Sequence?

Efficient Pythonic generator of the Fibonacci sequence I ...READ MORE

answered Aug 21, 2018 in Python by Priyaj
• 58,100 points
605 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP