Interview Questions JS

  • Explain Values and Types inJavascript

  • What is Scope in JavaScript?

  • Explain equality in Javascript

  • Explain Null and Undefined in Javascript

  • What is typeof operator?

  • What is the object type?

  • Explain arrays in JS

  • What is Coercion in JavaScript?

  • Provide some examples of non-bulean value coercion to a boolean

  • How to compare two objects in JavaScript?

  • What is Hoisting in JavaScript?

  • What is strict mode?

  • What is the difference between anonymous and named functions?

  • Describe closure concept in JavaScript as best as you

  • How does the this keyword work? Provide some code examples.

  • What is the "new" keyword in JavaScript?

  • What is a Polyfill?

  • What is the difference between a shim and a polyfill?

  • What does the term "Transpiling" stand for?

  • Could you explain the difference between ES5 and ES6

  • Explain prototype inheritance in JavaScript?

  • What is let keyword in JavaScript?

  • Being told that an unsorted array contains (n - 1) of n consecutive numbers (where the bounds are defined), find the missing number in O(n)

  • Remove duplicates of an array and return an array of only unique Array

  • Given an array of integers, find the largest difference between two elements such that the element of lesser value must come before the greater in JS Code

  • Find the intersection of two arrays. An intersection would be the common elements that exists within both arrays. In this case, these elements should be unique!

  • Find the Difference of two arrays. A Difference would be the non-common elements that is not there within both arrays. In this case

  • Given a string, reverse each word in the String

  • Given two strings, return true if they are anagrams of one

  • Check if a given string is a anagram

  • Implement enqueue and dequeue using only two Array in JS

  • Create a function that will evaluate if a given expression has balanced parentheses using JS Code.

  • Write a recursive function that returns the binary string of a given decimal

  • Write a recursive function that performs a binary search operation.

  • Given an integer, determine if it is a power of 2. If so, return that number, else return

  • Explain what is hoisting in JS.

  • Explain event bubbling and how one may prevent this and event delegation.

  • Explain the difference between "undefined" and "null" in JS.

  • What is the drawback of creating true private in JavaScript?

  • What is closure in javascript? Provide an example?

  • Write a "mul" function which will properly when invoked as below syntax.

  • How to empty an array in JavaScript?

  • How to check if an object is an array or not? Provide some code.

  • What will be the output of the following code?

  • What will be the output of the following code?

  • What will be the output of the following code?

  • What will be the output of the following code?

  • Describe the JS module design

  • Describe the Revealing Module Pattern design

  • Explain the Prototype Design Pattern.

  • What is IIFEs (Immediately Invoked Function Expressions)?

  • How would you use a closure to create a private counter?

  • How would you check if a number is an integer?

  • Write a function that would allow you to remove duplicates from array.

  • When would you use the "bind" function?

  • What does "use strict" do?

  • How would you add your own method to the Array object so the following code would work?

  • Explain what a callback function is and provide a simple example.

  • What will the following code output?

  • How would you create a private variable in JavaScript?

  • Check if a given string is a palindrome. Case sensitivity should be taken into account.

  • What is the Temporal Dead Zone in ES6?

  • What's the difference between using let and var to declare a variable in ES6?

  • When should I use Arrow functions in ES6?

  • When should you NOT use arrow functions in ES6? Name three or more cases.

  • What is the motivation for bringing Symbols to ES6?

  • What are the actual uses of ES6 WeakMap?

  • What's the difference between ES6 Map and WeakMap?

  • How can you share code between files?

  • What are the benefits of using spread syntax in ES6 and how is it different from rest syntax?

  • Can you give an example of a curry function and why this syntax offers an advantage?

  • What is 'Currying'?

  • Can you give an example for destructuring an object or an array in ES6?

  • What is the definition of a higher-order function?

  • What are the differences between ES6 class and ES5 function constructors?

  • Explain the differences on the usage of foo between function foo() {} and var foo = function() {}

  • What language constructions do you use for iterating over object properties and array items?

  • What are some of the advantages/disadvantages of writing JavaScript code in a language that compiles to JavaScript?

  • Why is it, in general, a good idea to leave the global scope of a website as-is and never touch it?

  • Why would you use something like the load event? Does this event have disadvantages? Do you know any alternatives, and why would you use those?

  • FizzBuzz

  • What are the advantages and disadvantages of using "use strict"?

  • How to use Arrow function and why should we use it

  • Explain the same-origin policy with regards to JavaScript.

  • What is the difference between == and ===?

  • What is the difference between document load event and document DOMContentLoaded event?

  • Why is extending built-in JavaScript objects not a good idea?

  • Explain how JSONP works (and how it's not really Ajax)

  • Explain Function.prototype.bind.

  • What's the difference between .call and .apply?

  • Explain difference between: function Person(){}, var person = Person(), and var person = new Person()?

  • What's the difference between host objects and native objects?

  • What's a typical use case for anonymous functions?

  • Can you describe the main difference between a .forEach loop and a .map() loop and why you would pick one versus the other?

  • What's the difference between a variable that is: null, undefined or undeclared? How would you go about checking for any of these states?

  • What is a closure, and how/why would you use one?

  • Explain why the following doesn't work as an IIFE. What needs to be changed to properly make it an IIFE?

  • What do you think of AMD vs CommonJS?

  • Suggest one simple way ofremovingduplicates from an array using

  • Is JavaScript a pass-by-reference or pass-by-value language?

  • Why should we use ES6 classes?

  • What is the preferred syntax for defining enums in JavaScript?

  • Explain the difference between Object.freeze() vs

  • How to "deep-freeze" object in JavaScript?

  • Is there anyway to force using strict mode in Node.js?

  • Could you compare usage of Module Pattern vs Constructor/Prototype pattern?

  • What's the difference between throw Error('msg') vs throw new Error('msg')?

  • In JavaScript, why is the this operator inconsistent?

  • What is generator in JS?

  • When should we use generators in ES6?

  • What is the difference between the await keyword and the yield keyword?

  • Is it possible to reset an ECMAScript 6 generator to its initial state?

  • Compare Async/Await and Generators usage to achive same

Comments