Important Front End Programmer Interview Preparation Guide
Download PDF

Front End Programmer based Frequently Asked Questions by expert members with experience as Front End Developer. These questions and answers will help you strengthen your technical skills, prepare for the new job test and quickly revise the concepts

67 Front End Developer Questions and Answers:

Table of Contents:

Important  Front End Developer Job Interview Questions and Answers
Important Front End Developer Job Interview Questions and Answers

1 :: Explain what is the lazy loading?

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 :: Explain what is the Difference between null and undefined?

null is an object with no value. undefined is a type.
typeof null; // "object"
typeof undefined; // "undefined"

3 :: What is variable scope?

JavaScript variables have functional scope.

4 :: Explain what is an IIFE?

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

5 :: What is a callback function?

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 :: Tell me why do we recommend external CSS or Javascript versus inline?

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 :: Explain what is Difference between null and undefined?

null is an object with no value. undefined is a type.
typeof null; // "object"
typeof undefined; // "undefined"

8 :: Explain what "this" is in JavaScript?

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

9 :: Do you know what is CORS? How does it work?

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.

11 :: Tell me how would you call a function directly on a string?

See section on using prototypes to call functions on common data types in JavaScript Objects & Prototypes.

12 :: Explain how to use a function a Class?

function functionName(name) {
this.name = name;
}
// Creating an object
var functionName = new functionName("WTEN");
console.log(functionName.name); //WTEN

14 :: Explain why table-less layout is very important?

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.

15 :: Explain what is an anonymous function?

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

16 :: Explain what is AJAX? Write an AJAX call?

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.

17 :: Explain what event bubbling is?

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.

18 :: Tell me what is stringify?

stringify is used to transform JSON into a string.

19 :: What are this and that keywords?

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

20 :: What is event delegation?

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

21 :: Tell me why do we need to use W3C standard code?

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.

22 :: How to clear a floated element?

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.

23 :: What is a float?

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

24 :: Tell us the purpose of each of the HTTP request types when used with a RESTful web service?

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.

25 :: Tell me how to optimize the page using front end code or technology?

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

1. 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

2. Use responsive design instead of making device based redirects

3. Use asynchronous Javascript and remove block level Javascript

4. Use Minify version of stylesheet and javascript.

5. Optimize Image and use correct format of Image. Use the lazy loading design pattern for large size of images.

6. Use browser side cache with Cache control

7. Avoid plugins to drive functionality

8. Configure view port and use CSS best practices

9. Prioritize visible content

10. Load style-sheets in header and script in footer.
Front End Developer Interview Questions and Answers
67 Front End Developer Interview Questions and Answers