front end Interview Questions


To rock the interview to achieve what you deserve and to improve your concepts about front end technologies, I have consolidated a list of questions and answers. It's a one stop solution for front end interview process.

##JavaScript: Basics and Tricky Questions 21+ questions and answers (for intermediate)


  1. What are the differences between null and undefined?
  2. What are the differences between == and ===?
  3. How would you compare two objects in JavaScript?
  4. 11+ true false related questions that will trick you.
  5. As [] is true, [] == true should also be true. right?
  6. How could you write a method on instance of a date which will give you next day?
  7. If you want to use an arbitrary object as value of this, how will you do that?
  8. Write a simple function to tell whether 2 is passed as parameter or not?
  9. How could you use Math.max to find the max value in an array?
  10. What the heck is this in JavaScript?
  11. 21 quick questions that will trick you.
  12. How could you set a prefix before everything you log? for example, if you log('my message') it will log: "(app) my message"
  13. What will you see in the console for the following example?
  14. Look at the code below, you have a for loop if you have setTimeout inside it. If log the loop counter inside setTimeout, what will be logged?
  15. Look at the code below, I have a property in a object and I am creating a new object where I am setting it to a new value. If I delete that property what will i get if I try to access that property?
  16. Does JavaScript pass parameter by value or by reference?
  17. How could you implement cache to save calculation time for a recursive fibonacci function?
  18. How could you cache execution of any function?
  19. If you need to implement the following chaining with call back, how will you implement it?
  20. How could you implement moveLeft animation?
  21. How would you implement currying for any functions?

####JS: Answer for Basics and Tricky Questions

##css: Basics and Tricky Questions 21+ questions and answers


  1. What does float do?
  2. How can you clear sides of a floating element?
  3. How can you clear sides of a floating element?
  4. some tricky questions in rapid fire style
  5. Does css properties are case sensitive?
  6. Why css selectors mixed up with cases don't apply the styles?
  7. Does margin-top or margin-bottom has effect on inline element?
  8. Does padding-top or padding-bottom has effect on inline element?
  9. Does padding-left or padding-right or margin-left or margin-right has effect on inline element?
  10. If you have a <p> element with font-size: 10rem, will the text be responsive when the user resizes / drags the browser window?
  11. The pseudo class :checked will select inputs with type radio or checkbox, but not
  12. In a HTML document, the pseudo class :root always refers to the element.
  13. The translate() function can move the position of an element on the z-axis.
  14. Which one would you prefer among px, em % or pt and why?
  15. How absolute, relative, fixed and static position differ?
  16. What are the differences between visibility hidden and display none?
  17. What are the differences between inline, block and inline-block?
  18. What are the properties related to box model?
  19. Does overflow: hidden create a new block formatting context?
  20. How could you apply css rules specific to a media?
  21. What is the use of only?
  22. Does the screen keyword apply to the device's physical screen or the browser's viewport?
  23. What are the some pseudo classed u have used?
  24. How do you align a p center-center inside a div?
  25. How do you optimize css selectors?
  26. How can you load css resources conditionally?
  27. Why would you use sprites?
  28. What is specificity? How do u calculate specificity?
  29. What is shadow DOM?
  30. What do you know about transition?
  31. What are the different css filter you can use?
  32. What are the reasons to use preprocessor?
  33. Show you couple of style example and you have to tell what does it do.

####CSS: Answer for Basics and Tricky Questions

###css Deleted questions! Looks like these are for hardcore designer. Hence, didn't make for developers.


  1. How descendant css selectors are matched? get answer
  2. How would u implement modularity in css?
  3. If something doesn't work in a specific browser (IE8), you would u approach this problem?
  4. How do you test cross-browser compatibility of your site?
  5. What is the greatest hack you did in css so far?
  6. What is grid layout?
  7. How can you make a site responsive?
  8. Why reset css is useful? or how normalize.css works?
  9. What do you know about text shadows, box shadows?

##JavaScript: Algorithm Beginners Level 20 questions and answers (for beginners)


  1. Verify a prime number?
  2. Find all prime factors of a number?
  3. Get nth Fibonacci number?
  4. Find the greatest common divisor of two numbers?
  5. Remove duplicate members from an array?
  6. merge two sorted array?
  7. Swap two numbers without using a temp variable?
  8. Reverse a string in JavaScript?
  9. How would you reverse words in a sentence?
  10. Reverse words in place?
  11. Find the first non repeating char in a string?
  12. Remove duplicate characters from a sting?
  13. How will you verify a word as palindrome?
  14. Generate random between 5 to 7 by using defined function.
  15. Find missing number from unsorted array of integers.
  16. Get two numbers that equal to a given number?
  17. Find the largest sum of any two elements?
  18. Total number of zeros from 1 upto n?
  19. Check whether a given string is a substring of bigger string
  20. Get permutaitons of a string

####JS: Answer for Algorithm Beginners Level

##JavaScript: DOM related Questions 21+ questions and answers (for intermediate JS Developers)


  1. Is there any difference between window and document?
  2. Does document.onload and window.onload fire at the same time?
  3. Is attribute similar to property?
  4. What are the different ways to get an element from DOM?
  5. What is the fastest way to select elements by using css selectors?
  6. How come, I can't use forEach or similar array methods on a NodeList?
  7. If you need to implement getElementByAttribute, how would you implement it?
  8. How would you add a class to an element by query selector?
  9. How could I verify whether one element is child of another?
  10. What is the best way to create a DOM element? Set innherHTML or use createElement?
  11. What is createDocumentFragment and why you might use it?
  12. What is reflow? What causes reflow? How could you reduce reflow?
  13. What is repaint and when does this happen?
  14. How could you make sure to run some JavaScript when DOM is ready like $(document).ready?
  15. What is event bubble? How does event flows in DOM?
  16. How would you destroy multiple list items with one click handler?
  17. Create a button that is destroyed by clicking in it but two new buttons are created in it's place.
  18. How could you capture all clicks in a page?
  19. How can you get all the texts in a web page?
  20. What is defer and async keyword does in a script tag?
  21. 10 rapid fire questions

####JS: Answers for DOM related Questions

##html: Basic Questions for Begginers 15 basic questions and asnwers


  1. Why do you need doctype?
  2. What are data-* attributes used for?
  3. How can you generate a public key in html?
  4. How do you change the direction of html text?
  5. How can you highlight text in html?
  6. Can you apply css to a part of html document only?
  7. Will a browser make http request for the following cases?
  8. Which resource would be downloaded first?
  9. What is an optional tag?
  10. What are the differences between div and span?
  11. How would you differentiate between div, section, and article?
  12. How would you select svg or canvas for your site?
  13. How to serve html in multiple languages?
  14. Explain standard and quirks mode.
  15. What is a semantic tag?

####HTML: Answers for Basic Questions

##JavaScript: LinkedList (part 4: work in process) Very rough stage..need to finish (for intermediate)

##JavaScript: search and Sort (part 5: work in process) Very rough stage..need to finish (for expert)

##JavaScript: Binary Search Tree (part 6: work in process) Very rough stage..need to finish (for expert)


##ToDO list

  1. CSS: Generate mock up from provided layout
  2. JavaScript: Programming challenges for expert
  3. HR related questions like
  4. What is your weakness
  5. Why are you leaving your current job
  6. Tell me about a project that you werent able to finish on time
  7. How you resolve conflict among team members
  8. How will you introduce a new technology to the team
  9. Do you prefere to work individually or in a team
  10. Sell this pen/coke/something to me
  11. How much salary do you want
  12. What you dont like you current job
  13. What you like least in your current job
  14. Tree Data Structure in JavaScript
  15. Graph and high order data structure in JavaScript

Inpsired by, darcyclarke, css-tricks, david shariff and some google results. If you want to add any question to this let me know.