■ JavaScript DSA Roadmap with Interview
Questions (Frontend Focused)
1. Strings
• Reverse a string
• Check palindrome (e.g. madam)
• Count vowels & consonants
• Find repeated characters
• Find first non-repeated character
• Check if two strings are anagrams
• Check substring (includes/startsWith/endsWith)
2. Arrays
• Reverse an array
• Find max and min element
• Find second largest element
• Remove duplicates (loop / Set / filter)
• Merge two arrays and sort
• Rotate an array by k steps
• Find missing number in array 1…n
• Find pair with sum = target
• Find intersection of two arrays
• Flatten nested array (e.g. [1,[2,[3]]] → [1,2,3])
3. Objects / Frequency Count
• Count frequency of elements in array
• Word count in a string
• Most frequent element in array
• Group objects by a property (e.g. age, department)
• Convert object → array and vice versa
4. Numbers / Math
• Factorial of a number
• Fibonacci series
• Prime number check
• Armstrong number check (153 → 1³+5³+3³=153)
• Sum of digits (e.g. 123 → 6)
• Reverse a number (e.g. 123 → 321)
5. Basic Algorithms
• Linear search
• Binary search
• Bubble sort
• Selection sort
• Quick sort (basic idea)
• Merge sort (concept)
6. ES6 / Advanced JS
• Difference between var, let, const
• Arrow function vs normal function
• Spread & Rest operator problems
• Destructuring objects/arrays
• Promise, async/await (basic usage)
• Map, Filter, Reduce problems
• Shallow vs Deep copy
• Null vs Undefined
• == vs ===
7. Bonus (sometimes asked)
• Recursion (factorial, fibonacci)
• Time complexity basics (O(n), O(n²))
• DOM-based problems (reverse input text, word counter)