Tags » Javscript

Fibonacci Series - Javascript

Fiboanacci Recursive

fibonacci series: 1, 1, 2, 3, 5, 8,……

1st fibonacci:1, 2nd fibonacci:1, 3rd fibonacci:2 ………….



//print nth fibonacci number recursive
function fibonacci(n)
{
	if(n<=2)
  return 1;
  
  return fibonacci(n-1)+fibonacci(n-2);
}

//alert(fibonacci(4));

//print first n fibonacci numbers
function fibonacciSeries(num)
{
	let fibArr=[];
	for(let i=1;i<=num;i++)
  {
  	fibArr.push(fibonacci(i));
  }
  
  return fibArr;
}

console.log(fibonacciSeries(6));

… 44 more words
Javscript

Sum All Numbers in a Range

 

We’ll pass you an array of two numbers. Return the sum of those two numbers and all numbers between them.

The lowest number will not always come first. 33 more words

Javscript

Javascript Prototype

There are two interrelated concepts with prototype in JavaScript:

  • First, every JavaScript function has a prototype property (this property is empty by default), and you attach properties and methods on this prototype property when you want to implement inheritance.
  • 2,022 more words
Javscript

Javascript Objects

An object is an unordered list of primitive data types (and sometimes reference data types) that is stored as a series of name-value pairs.

Each item in the list is called a property (functions are called methods). 1,377 more words

Javscript

Javascript Datatypes

JS Datatypes:
JavaScript has one complex data type (Reference datatype)

 

 

and it has five simple data types: (primitive datatypes)

Javscript

Javascript Basics

created in 1995 by Brendan Eich @ Netscapecreated in 1995 by Brendan Eich @ Netscapereleased in 1996 > LIvescriptECMASCript 1997ES3 1999ES5 2009ES6 2015
multi paradigm scripting language: uses syntax from C & JavaOO- with object prototypes instead of classesfunctional –  functions are objects, giving functions the capacity to hold executable code and be passed around like any other object. 3,273 more words

Javscript

Javascript DOM

js can access and modify all the html dom elementsjs can access and modify all the html dom elements
when a web page is loaded, browser creates dom of the page… 1,376 more words

Javscript