JS, Angular and Angular JS Top Interview Questions
1. Closures with respect to returning functions (Practical Usage of Closure in Question 21.) A closure is a function having access to the parent scope, even after the parent function has closed. var add = ( function () { var counter = 0 ; return function () {counter += 1 ; return counter} })(); add(); add(); add(); // the counter is now 3 2. This The JavaScript this keyword refers to the object it belongs to. 3. Inheritance in js //ES 5 Inheritance function Parent ( g , d ){ this . genes = g ; this . dna = d ; } Parent . prototype . getQualities = function (){ return this . genes + ' ' + this . dna ; } function Child ( g , d , m ){ Parent . call ( this , g , d ); this . myQualities = m ; } Child . prototype = Object . create ( Parent . prototype ); console . log ( new Parent ( "parent genes" , "parent dna" ). getQualities ()); console . log ( new Child ( "