Skip to content

AnshulNautiyal/js-tricky-question

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 

Repository files navigation

Want to Contribute?

Check this How to edit md file?

Question 1

function foo(a){
  demo();
  function demo(){
   console.log('Inside Demo function'); 
  }
}
foo();
foo(undefined);
foo(function(){ 
    console.log('Inside Anonymous function'); 
});

Question 2

setTimeout(function(){
    console.log('Inside 1');
    setTimeout(function(){
        console.log('Inside 2');
    },1000)
},1000);

setTimeout(function(){
    console.log('Inside 3');
},1000)

Question 3

const arr = ['1000','2000','3000',3000];

for(var i =0 ; i< arr.length;arr++){
    setTimeout(function(){
        console.log(` value at ${i} index: ${arr[i]} `);
},1000)
}

Question 4

let obj = {
    a:0,
    b:0
};

obj = {
    a:2,
    b: obj.a
};
console.log(obj);

Question 5

['123', '456', '789', '10'].map(parseInt);

Explanation

About

You think you can crack the interview?

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published