
-
// take input from the user const number = parseInt(prompt('Enter a positive number: ')); let n1 = 0, n2 = 1, nextTerm; console.log('Fibonacci Series:'); console.log(n1); // print 0 console.log(n2); // print 1 nextTerm = n1 + n2; while (nextTerm <= number) { // print the next term console.log(nextTerm); n1 = n2; n2 = nextTerm; nextTerm = n1 + n2; }
Code snippets to generate fibonacci series up to a certain number.
Bootstrap
Cmd
CodeIgniter
Css
Drupal
Git
Html
Javascript
Jquery
Laravel
Nodejs
Php
Python
Sql
Typescript
Wordpress
Random Code Snippet Queries: Javascript
- On click enter redirect to another URL with parameters in javascript
- Json stringify
- How to get the length of a number in JavaScript
- Uncaught TypeError: Illegal invocation
- Copy one array to another in javascript
- How to display an image in Javascript onclick
- Remove property from object in javascript
- How to add a property to object with condition in javascript
- How to echo array in Javascript
- Javascript get data-id attribute value
- How to remove duplicate values from array in javascript
- How to make entire Div clickable in javascript
- How to validate empty space in textbox in Javascript
- Remove hostname from URL in javascript
- Trim the leading and trailing comma from string in Javascript
- Uncaught TypeError: Assignment to constant variable
- Hide div on click outside of element in javascript/jQuery
- Animating numbers counting Javascript
- How to validate input type file size in javascript
- Concat variable with string in javascript
- How to push string in an array in Javascript
- How to get query string value in javascript
- How to open modal after redirect
- Check if value exists in array javascript
- Execute function with condition in javascript