ajayyadav.dev
Frontend interview roadmap
Step 03 · Frontend interview roadmap

JavaScript

Ordered as a path: clear Stage 1 before moving on.

Stage 1 · Foundations

Basic · 89 questions

Types, scope, hoisting, arrays, objects. Must be instant answers.

Show questions
1.What are the various data types in JavaScript?
2.How do you check the data type of a variable?
3.What's the difference between a variable that is null, undefined, or undeclared?
4.What are the differences between JavaScript variables created using let, var or const?
5.How do you convert a string to a number in JavaScript?
6.What are template literals and how are they used?
7.Explain the difference in hoisting between var, let, and const
8.How can you avoid problems related to hoisting?
9.What is the difference between == and === in JavaScript?
10.What language constructs do you use for iterating over object properties and array items in JavaScript?
11.What is the purpose of the break and continue statements?
12.What is the ternary operator and how is it used?
13.How do you access the index of an element in an array during iteration?
14.What is the purpose of the switch statement?
15.What are rest parameters and how are they used?
16.What are the benefits of using spread syntax in JavaScript and how is it different from rest syntax?
17.Explain the difference in the usage of foo between function foo() {} and var foo = function() {}
18.What is the difference between a parameter and an argument?
19.What's the difference between .call and .apply in JavaScript?
20.Can you give a use case for the arrow (=>) function syntax?
21.What is the difference between function Person(){}, const person = Person(), and const person = new Person()?
22.What is the definition of a higher-order function in JavaScript?
23.What are callback functions and how are they used?
24.What is recursion and how is it used in JavaScript?
25.What are default parameters and how are they used?
26.What are the various ways to create objects in JavaScript?
27.Explain the difference between dot notation and bracket notation for accessing object properties
28.What are the different methods for iterating over an array?
29.How do you add, remove, and update elements in an array?
30.What are the different ways to copy an object or an array?
31.Explain the difference between shallow copy and deep copy
32.How do you check if an object has a specific property?
33.Explain the concept of destructuring assignment for objects and arrays
34.How do you reliably determine whether an object is empty?
35.What is the event loop in JavaScript runtimes?
36.Explain the difference between synchronous and asynchronous functions in JavaScript
37.What are Promises and how do they work?
38.How do you handle errors in asynchronous operations?
39.Explain how prototypal inheritance works in JavaScript
40.Explain the difference between classical inheritance and prototypal inheritance
41.Explain the concept of inheritance in ES2015 classes
42.What is the purpose of the new keyword?
43.How do you create a constructor function?
44.What are the differences between JavaScript ES2015 classes and ES5 function constructors?
45.What advantage is there to using arrow syntax for a method in a constructor?
46.Explain the concept of scope and lexical scoping in JavaScript
47.How can closures be used to create private variables?
48.Explain the difference between global scope, function scope, and block scope
49.Explain how this works in JavaScript
50.Explain Function.prototype.bind in JavaScript
51.What are the common pitfalls of using the this keyword?
52.Explain the concept of this binding in event handlers
53.What is the DOM and how is it structured?
54.Explain the difference between document.querySelector() and document.getElementById()
55.How do you add, remove, and modify HTML elements using JavaScript?
56.What are event listeners and how are they used?
57.Describe event bubbling in JavaScript and browsers
58.Describe event capturing in JavaScript and browsers
59.Explain event delegation in JavaScript
60.How do you prevent the default behavior of an event?
61.What is the difference between the mouseenter and mouseover events?
62.How do you manipulate CSS styles using JavaScript?
63.Describe the difference between <script>, <script async> and <script defer>
64.Describe the difference between a cookie, sessionStorage and localStorage in browsers
65.How do you make an HTTP request using the Fetch API?
66.What are the different ways to make an API call in JavaScript?
67.Explain AJAX in detail
68.What are the advantages and disadvantages of using AJAX?
69.What are the differences between XMLHttpRequest and fetch() in JavaScript and browsers?
70.How do you use window.history API?
71.How do you redirect to a new page in JavaScript?
72.How do you get the query string values of the current page in JavaScript?
73.What are modules and why are they useful?
74.How do you import and export modules in JavaScript?
75.How do you handle errors using try...catch blocks?
76.What is the purpose of the finally block?
77.What are Sets and Maps and how are they used?
78.What are the differences between Map/Set and WeakMap/WeakSet in JavaScript?
79.How do you convert a Set to an array in JavaScript?
80.What is the difference between a Map object and a plain object in JavaScript?
81.How do Sets and Maps handle equality checks for objects?
82.Explain the concept of debouncing and throttling
83.Explain the concept of lazy loading and how it can improve performance
84.Explain the concept of caching and how it can be used to improve performance
85.What are some tools that can be used for JavaScript testing?
86.What are design patterns and why are they useful?
87.Explain the concept of the Singleton pattern
88.Explain the concept of the Prototype pattern
89.How can you share code between JavaScript files?
Stage 2 · Core concepts

Intermediate · 63 questions

Closures, this, prototypes, async, event loop, DOM.

Show questions
1.Why is it generally a good idea to leave the global scope of a website as-is and never touch it?
2.Explain the concept of tagged templates
3.What are Symbols used for in JavaScript?
4.What's a typical use case for anonymous functions in JavaScript?
5.Explain the difference between mutable and immutable objects in JavaScript
6.What is Object.freeze() for?
7.What is Object.seal() for?
8.What is Object.preventExtensions() for?
9.What are JavaScript object getters and setters for?
10.Explain the different states of a Promise
11.What are the pros and cons of using Promises instead of callbacks in JavaScript?
12.What does Promise.all() do, and how is it different from Promise.allSettled()?
13.What is async/await and how does it simplify asynchronous code?
14.Explain the concept of a microtask queue
15.What is the difference between setTimeout(), setImmediate(), and process.nextTick()?
16.What is the prototype chain and how does it work?
17.Why might you want to create static class members in JavaScript?
18.What is a closure in JavaScript, and how/why would you use one?
19.What are the potential pitfalls of using closures?
20.Explain the different ways the this keyword can be bound
21.What's the difference between an “attribute” and a “property” in the DOM?
22.Explain the event phases in a browser
23.What is the difference between event.preventDefault() and event.stopPropagation()?
24.What is the difference between innerHTML and textContent?
25.What is the difference between the Window object and the Document object?
26.How do you abort a web request using AbortController in JavaScript?
27.Explain the concept of the WebSocket API
28.What is the Intl namespace object for?
29.How do iframes on a page communicate with each other?
30.What is the difference between the document load event and the DOMContentLoaded event?
31.What are Progressive Web Applications (PWAs)?
32.Explain the differences between CommonJS modules and ES modules in JavaScript
33.What are the benefits of using a module bundler?
34.Explain the concept of tree shaking in module bundling
35.What are the different types of errors in JavaScript?
36.How can you create custom error objects?
37.Explain the concept of error propagation in JavaScript
38.What are currying and partial application, how do they differ, and when would you use them?
39.What are some common performance bottlenecks in JavaScript applications?
40.What are the different types of testing in software development?
41.Explain the difference between unit testing, integration testing, and end-to-end testing
42.How do you write unit tests for JavaScript code?
43.Explain the concept of test-driven development (TDD)
44.How can you test asynchronous code in JavaScript?
45.What are some best practices for writing maintainable and effective tests in JavaScript?
46.Explain the concept of code coverage and how it can be used to assess test quality
47.What is the Factory pattern and how is it used?
48.Explain the Observer pattern and its use cases
49.What is the Module pattern and how does it help with encapsulation?
50.What is the Decorator pattern and how is it used?
51.Explain the concept of the Strategy pattern
52.What is the Command pattern and how is it used?
53.Why is extending built-in JavaScript objects not a good idea?
54.What is Cross-Site Scripting (XSS) and how can you prevent it?
55.Explain the concept of Cross-Site Request Forgery (CSRF) and its mitigation techniques
56.What are some best practices for handling sensitive data in JavaScript?
57.Explain the concept of Content Security Policy (CSP) and how it enhances security
58.What are some common security headers and their purpose?
59.Explain the concept of input validation and its importance in security
60.What are some tools and techniques for identifying security vulnerabilities in JavaScript code?
61.Explain the same-origin policy with regard to JavaScript
62.What tools and techniques do you use for debugging JavaScript code?
63.Explain what a single page app is and how to make one SEO-friendly
Stage 3 · Deep dive

Advanced · 19 questions

Internals, performance, patterns. Separates good from great.

Show questions
1.What are proxies in JavaScript used for?
2.How does hoisting affect function declarations and expressions?
3.What are iterators and generators in JavaScript and what are they used for?
4.Explain why the following doesn't work as an IIFE: function foo(){}();. What needs to be changed to properly make it an IIFE?
5.What are JavaScript object property flags and descriptors?
6.What are JavaScript polyfills for?
7.How do you validate form elements using the Constraint Validation API?
8.What are server-sent events?
9.How can you optimize DOM manipulation for better performance?
10.What are some techniques for reducing reflows and repaints?
11.What are Web Workers and how can they be used to improve performance?
12.What are some tools that can be used to measure and analyze JavaScript performance?
13.How can you optimize network requests for better performance?
14.What are mocks and stubs and how are they used in testing?
15.How can you prevent clickjacking attacks?
16.How can you implement secure authentication and authorization in JavaScript applications?
17.What is 'use strict' in JavaScript for?
18.How does JavaScript garbage collection work?
19.What are some of the advantages/disadvantages of writing JavaScript code in a language that compiles to JavaScript?