Advanced JavaScript interview questions.

Any web development interview will not be completed without JavaScript questions. JavaScript is now one of the most used scripting language in the World. It is heavily used in front-end and now-a-days in the backend (Node.js). The introduction of ES6 added more momentum to JavaScript. ReactJS getting immense popularity for building reactive applications. So JavaScript is in booming phase. Any web developer should have a basic understanding of JavaScript.

The concept of full-stack developer includes major parts of JavaScript. If someone claims to be a full-stack developer, he or she must have clear understanding of JavaScript. For the web developers JavaScript skill is a must!

Following are some advanced JavaScript interview questions:

  • How the event loop works in JavaScript?
  • What is event bubbling and event capturing?
  • Is JavaScript a pass-by-reference or pass-by-value language? and Why?
  • What are the main difference between a .forEach loop and a .map() loop?
  • Explain the prototypical inheritance with example
  • What are the ways to empty a JavaScript array?
  • What will be the output of the following code and why?
    function closureInLoop() {
      for(var i = 0; i < 3 ;i++) {
        setTimeout(function(){
          console.log(i)
        })
      }
    }
    closureInLoop();
       
  • What will be the output of the following code and why?
    var popstar = 'Justin Bieber';
    var obj = {
      popstar: 'Taylor Swift',
      getPopstarName: function() {
        return this.popstar;
      }
    };
    var temp = obj.getPopstarName;
    console.log(temp());
       
  • What are the differences between localStorage and cookie?
  • How can we stop the modification of an object in JavaScript?
  • How can we use constructor functions for inheritance in JavaScript?
  • How can we find the value of a variable in an array?
Share