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"
JavaScript variables have functional scope.
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 "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.
8. 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.
9. What is the difference between JSON and JSONP?
JSONP is JSON with padding.
10. 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.
11. 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
13. 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.
14. 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
15. 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.
16. 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.
17. Tell me what is stringify?
stringify is used to transform JSON into a string.
18. 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.
Event delegation allows you to avoid adding event listeners for specific nodes. Instead, you can add a single event listener to a parent element.
20. 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.
21. 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.
Floats are used to push elements to the left or right, so other elements wrap around it.
23. 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.
24. 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.
25. Have you ever used a CSS preprocessor/precompiler? What are the benefits?
CSS preprocessors, such as SASS, have numerous benefits, such as variables and nesting.
26. Do you know what is the importance of the HTML DOCTYPE?
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).
27. What is the difference between responsive and adaptive development?
In a nutshell, responsive is fluid and flexible, whereas adaptive adapts to the detected device/screen size.
28. Tell me where do you place your JavaScript on the page?
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.
29. Explain the difference between inline, block, inline-block and box-sizing?
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.
30. Explain what is web a application?
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.
31. HTML / HTML5 Based Front End Developer Interview Questions:
☛ What is Doctype & why its important?
☛ What are meta tags?
☛ What does meta viewport tag do?
☛ Difference between div and span?
☛ What is html5?
☛ Name a few new tags in html5 and their advantages?
☛ What are the new media-related elements in HTML5?
☛ How can I create a div work like an input?
32. CSS / CSS3 Based Front End Developer Interview Questions:
☛ Difference between position absolute and fixed?
☛ What is the difference between inline, inline-block, and block?
☛ Difference between ID and Class?
☛ What are sprites and why they are recommended?
☛ what are media queries?
☛ What is responsiveness?
☛ How to select last li of ul via CSS?
☛ Difference between; .class.class2 & .class .class & .class > class ?
☛ What are CSS pre-processors?
☛ What is style reset sheet?
☛ What is float?
33. JQuery / JavaScript Based Front End Developer Interview Questions:
☛ What is jQuery?
☛ What is difference between onload and ready?
☛ How to select class in jQuery?
☛ Which selector has better performance id or class and why?
☛ How to add a class to HTML element?
☛ What is jQuery toggle function?
☛ Explain difference .empty() between .remove()?
☛ How can I select 20th div with jQuery?
☛ What is difference between .setinterval() & .delay()?
34. WordPress Based Front End Developer Interview Questions:
☛ What are basic necessities for a theme? How will you create a Hello World! WordPress theme?
☛ Do you have developed plug-in?
☛ How will you create a template page in WordPress?
☛ How can you create an empty plugin which have basic options like activate, deactivate etc.?
35. Deployment Skills Based Front End Developer Interview Questions:
☛ What do you use xampp or wampp & why?
☛ What is cPanel?
☛ What will be your workaround deploying a local site to live url?
☛ Name some online resources that you reference when having CSS/HTML/JS issues.
☛ Favorite tools and IDEs?
☛ Why stack overflow so useful? and whats your rating?