Front End Developer Interview Questions & Answers

Front End Developer Interview Questions

Searching for front end developer job? Don’t know how to prepare for the interviews? Then this is the right platform to search, apply and prepare well for the interviews. A front developer should be tech-savvy and able to translate the customer needs into interactive web apps. If you are expertise in turning UI/UX designs into prototypes and creating innovative interactions from designs and able to write reusable content modules then go through our front end developer job interview questions and answers for immediate results to get shortlisted for the jobs. Top companies are looking to hire for front end developer positions to create elegant, usable, responsive and interactive interfaces across multiple devices. Search and apply for various front end developer positions across locations like Bangalore, Hyderabad, Chennai, Pune, Mumbai and Kolkata positions.

Front End Developer Interview Questions And Answers

Front End Developer Interview Questions
    1. Question 1. Explain What Is The Lazy Loading?

      Answer :

      Lazy loading is a design pattern commonly used in computer programming to defer initialization of an object until the point at which it is needed.

      Lazy loading is loading code only once user needs it. For Example, there is a button on the page, which shows different layout once user pressed it. So there is no need to load code for that layout on initial page load.

    2. Question 2. Explain What Is The Difference Between Null And Undefined?

      Answer :

      null is an object with no value. undefined is a type. 

      typeof null; // "object" 

      typeof undefined; // "undefined"

    3. Question 3. What Is Variable Scope?

      Answer :

      JavaScript variables have functional scope.

    4. Question 4. Explain What Is An Iife?

      Answer :

      IIFE stands for immediately-invoked function expression; it executes immediately after created by adding a () after the function.

    5. Question 5. What Is A Callback Function?

      Answer :

      JavaScript is read line by line. Sometimes, this can result in what seems like a subsequent line of code being executed prior to an earlier line of code. A callback function is used to prevent this from happening, because it is not called until the previous line of code has fully executed.

    6. Question 6. Tell Me Why Do We Recommend External Css Or Javascript Versus Inline?

      Answer :

      Inline CSS or Javascript has bad impact on site performance.

      Your HTML code will weigh more as you use inline scripts, whereas external scripts reduces HTML file size which helps fast rendering of webpage.

      HTML code will never be cached so inline scripts. Contrary to that, external dependencies, such as CSS and JavaScript files, will be cached by the visitor's web browser. So it reduces https requests each time user click through web pages.

      It is hard to maintain Inline CSS and Javascript code. Where having code in just one centralized location is a lot more preferable than changing exactly the same kind of code snippets spread all over the files in the web site.

    7. Question 7. Explain What "this" Is In Javascript?

      Answer :

      In JavaScript, 'this' normally refers to the object which 'owns' the method, but it depends on how a function is called.

    8. Question 8. Do You Know What Is Cors? How Does It Work?

      Answer :

      Cross-origin resource sharing (CORS) is a mechanism that allows many resources (e.g., fonts, JavaScript, etc.) on a web page to be requested from another domain outside the domain from which the resource originated. It's a mechanism supported in HTML5 that manages XMLHttpRequest access to a domain different.

      CORS adds new HTTP headers that provide access to permitted origin domains. For HTTP methods other than GET (or POST with certain MIME types), the specification mandates that browsers first use an HTTP OPTIONS request header to solicit a list of supported (and available) methods from the server. The actual request can then be submitted. Servers can also notify clients whether "credentials" (including Cookies and HTTP Authentication data) should be sent with requests.

    9. Question 9. What Is The Difference Between Json And Jsonp?

      Answer :

      JSONP is JSON with padding.

    10. Question 10. Explain How To Use A Function A Class?

      Answer :

      function functionName(name) { = name;

      // Creating an object

      var functionName = new functionName("WTEN"); 
      console.log(; //WTEN

    11. Question 11. Tell Me How Do You Clear A Floated Element?

      Answer :


    12. Question 12. Explain Why Table-less Layout Is Very Important?

      Answer :

      There are several reasons why web designers should stop using tables for layouts, and adopt the use of CSS for controlling HTML layouts.

      1. It adheres to current W3C web standards and it improves accessibility of the information to a wider variety of users, using a wide variety of user agents.
      2. There are bandwidth savings as large numbers of semantically meaningless <table>, <tr> and <td> tags are removed from dozens of pages leaving fewer, but more meaningful headings, paragraphs and lists.
      3. Layout instructions are transferred into site-wide CSS stylesheets, which can be downloaded once and cached for reuse while each visitor navigates the site.
      4. If coded well, CSS makes it easy to apply global changes to the layout
      5. Web pages often have less code, and are much thinner when XHTML and CSS are used
      6. Sites may become more maintainable as the whole site can be restyled or re-branded in a single pass merely by altering the mark-up of the specific CSS, affecting every page which relies on that stylesheet.
      7. New HTML content can be added in such a way that consistent layout rules are immediately applied to it by the existing CSS without any further effort.

    13. Question 13. Explain What Is An Anonymous Function?

      Answer :

      Anonymous functions are functions without a name. They are stored in a variable and are automatically invoked (called) using the variable name.

      var x = function(a, b) {
      console.log(a * b)
      x(3, 5); // 15

    14. Question 14. Explain What Is Ajax? Write An Ajax Call?

      Answer :

      AJAX stands for asynchronous JavaScript and XML and allows applications to send and retrieve data to/from a server asynchronously (in the background) without refreshing the page. For example, your new Gmail messages appear and are marked as new even if you have not refreshed the page.

    15. Question 15. Explain What Event Bubbling Is?

      Answer :

      Event bubbling causes all events in the child nodes to be automatically passed to its parent nodes. The benefit of this method is speed because the code only needs to traverse the DOM tree once.

    16. Question 16. What Is Stringify?

      Answer :

      stringify is used to transform JSON into a string.

    17. Question 17. What Are This And That Keywords?

      Answer :

      This and that are important to variable scope in JavaScript. Here are a few stackoverflow posts on this, that and self.

    18. Question 18. What Is Event Delegation?

      Answer :

      Event delegation allows you to avoid adding event listeners for specific nodes. Instead, you can add a single event listener to a parent element.

    19. Question 19. Why Do We Need To Use W3c Standard Code?

      Answer :

      The goals of such standards are to ensure cross-platform compatibility and more compact file sizes. The focus of these standards has been to separate "content" from "formatting" by implementing CSS. It eases maintenance and development.

    20. Question 20. How To Clear A Floated Element?

      Answer :

      A floated element is taken out of the document flow. To clear it you would need to do a clear:both or try overflow:auto on the containing div.

    21. Question 21. What Is A Float?

      Answer :

      Floats are used to push elements to the left or right, so other elements wrap around it.

    22. Question 22. Tell Us The Purpose Of Each Of The Http Request Types When Used With A Restful Web Service?

      Answer :

      The purpose of each of the HTTP request types when used with a RESTful web service is as follows:

      • GET: Retrieves data from the server (should only retrieve data and should have no other effect).
      • POST: Sends data to the server for a new entity. It is often used when uploading a file or submitting a completed web form.
      • PUT: Similar to POST, but used to replace an existing entity.
      • PATCH: Similar to PUT, but used to update only certain fields within an existing entity.
      • DELETE: Removes data from the server.
      • TRACE: Provides a means to test what a machine along the network path receives when a request is made. As such, it simply returns what was sent.
      • OPTIONS: Allows a client to request information about the request methods supported by a service. The relevant response header is Allow and it simply lists the supported methods. (It can also be used to request information about the request methods supported for the server where the service resides by using a * wildcard in the URI.)
      • HEAD: Same as the GET method for a resource, but returns only the response headers (i.e., with no entity-body).
      • CONNECT: Primarily used to establish a network connection to a resource (usually via some proxy that can be requested to forward an HTTP request as TCP and maintain the connection). Once established, the response sends a 200 status code and a "Connection Established" message.

    23. Question 23. How To Optimize The Page Using Front End Code Or Technology?

      Answer :

      Below is the list of best practices for front-end technology, which helps to optimize page.

      • Improve server response by reducing resource usage per page
        • Combine all external CSS files into one file
        • Combine all external JS files into one file
      • Use responsive design instead of making device based redirects
      • Use asynchronous Javascript and remove block level Javascript
      • Use Minify version of stylesheet and javascript.
      • Optimize Image and use correct format of Image. Use the lazy loading design pattern for large size of images.
      • Use browser side cache with Cache control.
      • Avoid plugins to drive functionality.
      • Configure view port and use CSS best practices.
      • Prioritize visible content.
      • Load style-sheets in header and script in footer.

    24. Question 24. Have You Ever Used A Css Preprocessor/precompiler? What Are The Benefits?

      Answer :

      CSS preprocessors, such as SASS, have numerous benefits, such as variables and nesting.

    25. Question 25. Do You Know What Is The Importance Of The Html Doctype?

      Answer :

      DOCTYPE is an instruction to the web browser about what version of the markup language the page is written. Its written before the HTML Tag. Doctype declaration refers to a Document Type Definition (DTD).

    26. Question 26. What Is The Difference Between Responsive And Adaptive Development?

      Answer :

      In a nutshell, responsive is fluid and flexible, whereas adaptive adapts to the detected device/screen size.

    27. Question 27. Tell Me Where Do You Place Your Javascript On The Page?

      Answer :

      It may depend on what you are using it for. There is some debate on this but generally a good question to ask to get an understanding of the JS knowledge.

    28. Question 28. Explain The Difference Between Inline, Block, Inline-block And Box-sizing?

      Answer :

      • inline is the default. An example of an inline element is <span>.
      • block displays as a block element, such as <div> or <p>.
      • inline-block displays an element as an inline-level block container. Here's an article on the topic.
      • box-sizing tells the browser sizing properties.

    29. Question 29. Explain What Is Web A Application?

      Answer :

      A great question to feel out the depth of the applicants knowledge and experience.

      A web application is an application utilizing web and [web] browser technologies to accomplish one or more tasks over a network, typically through a [web] browser.

    30. Question 30. Explain What Is The Importance Of The Html Doctype?

      Answer :

      The doctype declaration should be the very first thing in an HTML document, before the html tag.

      The doctype declaration is not an HTML tag; it is an instruction to the web browser about what version of the markup language the page is written in.

      The doctype declaration refers to a Document Type Definition (DTD). The DTD specifies the rules for the markup language, so that the browsers can render the content correctly.

    31. Question 31. What Are The Difference Between Get And Post?

      Answer :

      A GET request is typically used for things like AJAX calls to an API (insignificant changes), whereas a POST request is typically used to store data in a database or submit data via a form (significant changes). GET requests are less secure and can be seen by the user in the URL, whereas POST requests are processed in two steps and are not seen by the user. Therefore, POST requests are more secure.

    32. Question 32. Explain What Is The Difference Between A Prototype And A Class?

      Answer :

      Prototype-based inheritance allows you to create new objects with a single operator; class-based inheritance allows you to create new objects through instantiation. Prototypes are more concrete than classes, as they are examples of objects rather than descriptions of format and instantiation.

      Prototypes are important in JavaScript because JavaScript does not have classical inheritance based on classes; all inheritances happen through prototypes. If the JavaScript runtime can't find an object's property, it looks to the object's prototype, and continues up the prototype chain until the property is found.

    33. Question 33. What Is The Difference Between Call And Apply?

      Answer :

      apply lets you invoke the function with arguments as an array. call requires the parameters to be listed explicitly. Also, check out this stackoverflow answer.

    34. Question 34. Explain The Difference Between Visibility:hidden; And Display:none?

      Answer :

      • Visibility:Hidden; - It is not visible but takes up it's original space.
      • Display:None; - It is hidden and takes no space.

    35. Question 35. Tell Me The Difference Between Visibility:hidden; And Display:none;?

      Answer :

      • Visibility:Hidden; - It is not visible but takes up it's original space.
      • Display:None; - It is hidden and takes up absolutely no space as if it was never there.

    36. Question 36. How To Increase Page Performance?

      Answer :

      • Sprites, compressed images, smaller images; 
      • include JavaScript at the bottom of the page; 
      • minify or concatenate your CSS and JavaScript; and 
      • caching.

    37. Question 37. Do You Know What Is A Sprite? How Is It Applied Using Css? What Is The Benefit?

      Answer :

      • A image sprite is a collection of images put into one single image.
      • Using css positioning you can show and hide different parts of the sprite depending on what you need.
      • Sprites reduces the number of http requsts thus reducing load time of page and bandwidth

      Buy Buttons using Sprite as background:

      Both buttons use the same background image. The only differece is in the positioning.

      Here is the actual background image:

      And the CSS.

      .orangeBuyBtn {
      background: url('buyButtons-bg.gif') repeat-x 0 0;
      border-color: #5B5752 #6B6B6B #808080;
      border-style: solid;
      border-width: 1px;
      color: #FFFFFF;
      cursor: pointer;
      font-size: 14px;
      font-weight: bold;

      .greenBuyBtn {
      background: url('buyButtons-bg.gif') repeat-x 0 -24px;
      border-color: #5B5752 #6B6B6B #808080;
      border-style: solid;
      border-width: 1px;
      color: #FFFFFF;
      cursor: pointer;
      font-size: 14px;
      font-weight: bold;


    38. Question 38. Explain The Difference Between Static, Fixed, Absolute And Relative Positioning?

      Answer :

      • static is the default.
      • fixed is positioned relative to the browser.
      • absolute is positioned relative to its parent or ancestor element.
      • relative is positioned relative to normal positioning/the item itself. Used alone it accomplishes nothing.

    39. Question 39. How Do Browsers Read Css?

      Answer :

      From right to left.

    40. Question 40. Explain Some Common Ie6 Bugs And How You Dealt With Them?

      Answer :

      Ie6 is not dead, just ask China which represents a nice chunk of the worlds online population. Your pages should at least be functional on IE6, unless you dont care about half the worlds population.

    41. Question 41. What Is A Clear?

      Answer :

      A clear is used when you don't want an element to wrap around another element, such as a float.

    42. Question 42. What Is The Difference Between Html And Xhtml?

      Answer :

      HTML is HyperText Markup Language used to develop the website.

      XHTML is modern version of HTML 4. XHTML is an HTML that follows the XML rules which should be well-formed.

    43. Question 43. What Is A Javascript Object?

      Answer :

      A collection of data containing both properties and methods. Each element in a document is an object. Using the DOM you can get at each of these elements/objects and do some cool sh*t.

    44. Question 44. What Is The Difference Between Form Get And Form Post?

      Answer :


      With GET the form data is encoded into a URL by the browser. The form data is visible in the URL allowing it to be bookmarked and stored in web history. The form data is restricted to ASCII codes. Because URL lengths are limited there can be limitations on how much form data can be sent.


      With POST all the name value pairs are submitted in the message body of the HTTP request which has no restrictions on the length of the string. The name value pairs cannot be seen in the web browser bar.

      POST and GET correspond to different HTTP requests and they differ in how they are submitted. Since the data is encoded in differently, different decoding may be needed.

    45. Question 45. Explain The Difference Between == And === ?

      Answer :

      The 3 equal signs mean "equality without type coercion". Using the triple equals, the values must be equal in type as well. 

      • == is equal to 
      • === is exactly equal to (value and type)
      • 0==false // true 
      • 0===false // false, because they are of a different type
      • 1=="1" // true, auto type coercion
      • 1==="1" // false, because they are of a different type

    46. Question 46. Do You Know What Is A Closure?

      Answer :

      Closures are expressions, usually functions, which can work with variables set within a certain context. Or, to try and make it easier, inner functions referring to local variables of its outer function create closures.

    47. Question 47. Do You Know What Is The Difference Between == And === ?

      Answer :

      • == is equal to 
      • === is exactly equal to (value and type)

    48. Question 48. Tell Me Are You Familiar With Jasmine Or Qunit?

      Answer :

      Jasmine and QUnit are JavaScript testing frameworks. I would familiarize yourself with the basics.

    49. Question 49. What Is The Difference Between A Host Object And A Native Object?

      Answer :

      Native - existing in JavaScript. Host - existing in the environment.

Popular Interview Questions

All Interview Questions

Front End Developer Practice Test

All rights reserved © 2020 Wisdom IT Services India Pvt. Ltd Protection Status

Internet Technologies Tutorial