Fibonacci Series in JS
by Ishank Dubey
HTML
<math xmlns="http://www.w3.org/1998/Math/MathML">
<mrow>
<mrow>
<msup> <mi>x</mi> <mn>2</mn> </msup> <mo>+</mo>
<mrow>
<mn>4</mn>
<mo>⁢</mo>
<mi>x</mi>
</mrow>
<mo>+</mo>
<mn>4</mn>
</mrow>
<mo>=</mo>
<mn>0</mn>
</mrow>
<br>
<mrow>
<mi>A</mi>
<mo>=</mo>
<mfenced open="[" close="]">
<mtable>
<mtr>
<mtd><mi>x</mi></mtd>
<mtd><mi>y</mi></mtd>
</mtr>
<mtr>
<mtd><mi>z</mi></mtd>
<mtd><mi>w</mi></mtd>
</mtr>
</mtable>
</mfenced>
</mrow>
</math>
JavaScript
function partial() {
this.prop1 = "one";
};
function child() {
this.child = "chaild";
};
child.prototype = Object.create(partial.prototype);
var aObj = new child();
//console.log(child);
for (var x = 0; x < 5; x++) {
(function(x) {
setTimeout(function() {
//'small experiment' console.log(x); vs alert(x);
}, 5);
})(x);
}
var current = 0,
last = 1,
first = 0;
for (let i = 0; i < 10; i++) {
console.log(current);
first = last;
last = current;
current = last + first;
}
function* agenerator(){
yield 2;
};
var aGen = agenerator();
console.log(JSON.stringify(aGen.next())+"-"+JSON.stringify(aGen.next()));