Search This Blog

Unanswered

Q6. what will be the output of

Answer:
(function(){
  for (var i = 0; i < 5; i ++)
    {
      setTimeout(function(){
      console.log('Timer-' + i);
      },1000);
      console.log(i);
    }
})();

Answer:
0
1
2
3
4
"Timer-5"
"Timer-5"
"Timer-5"
"Timer-5"
"Timer-5"

Q. Difference between spread operator and REST operatgor in javascript



1. What is the difference between == and === in javaScript?
2. What is the output of 
 let a = 1 + '1'; // 11
= 1 + '1' + 1; // 111
= 1 + true + '1'; //21

3. out put of 
var a;
var a; // no Error
 let a;
let a; // Error: Duplicate declaration of a

------------------------
Q. why we need callback ?
Q. How to use next symbol with iterator in JavaScript?

Q33. What are Iterators and Generators in JavaScript?

Answer:
An object is an iterator when it knows how to access items from a collection one at a time, while keeping track of its current position within that sequence.
A GeneratorFunction is a special type of function that works as a factory for iterators. A function becomes a GeneratorFunction if it uses the function* syntax.
Some built-in types, such as Array or Map, have a default iteration behavior, while other types (such as Object) do not. In order to be iterable, an object must implement the @@iterator method, meaning that the object (or one of the objects up its prototype chain) must have a property with a Symbol.iterator key



https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Iterators_and_Generators

What is *
----------------------------
Q 4) What is Polymorphism in JavaScript? (m = moved)

Answer: We can see polymorphism in JavaScript when we try to create a new object say objnew from exiting object say objold using Object.Create and then creating your objnew's function with same name as of objold's function. it would be like overriding the previous object function definition.
-------------------------------------------------------
68. Few new improvement of ECMA6?

Answer: Introduction of new keywords LET and CONST.
Keywords like CLASS, Constructor, Extend etc
Concept of this keyword
2. What is Iterators in JavaScript?
3. What is function* in JavaScript?

----------------JavaScript---------------------
q. What are Generators in JavaScript
3. Write a closure with example on paper.
4. output of console.log(null===undefined)? and why?
10) What are primitive data types in java script?

What about apply and call functions in java script?
 What about event propagation in java script?
 What about promises and callback in java script?
Q) why it is consider to be good practise to put your code in side closure wrapping or self executing method
eg
(function(){
...code here
})();

<----->
output of
var a = 12;
var b = a;
b = 20;
console.log(a);

what is difference between DOM elements and HTML elements.
javascript default inheritance type
by default javascript passes data  by value or by reference
difference between abstraction and encapsulation in javascript
can we change prototpye of parent using child object
98. What is difference between Callbacks, Ajax calls, Promises, observables?
7. What is forin and forat in  javascript?

5. output of console.log(a);

6. function () {
    var a = 2;
    console.log(a);
    function 2 () {
    let a = 3;
    console.log(a);
    }
    console.log(a);
    }
    Q41. Explain how for..each loop works in JavaScript and how it is different from for..in and for..of?
    Q. Whats the difference between iterators and iterables?

Q. loops in JavaScript
for loop
for..each
for..in
for..of


No comments:

Post a Comment