Sunday 4 January 2015

Front End Developer Interview Questions and Answers

Front End Developer Interview Questions and Answers

Question: 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).


Question: Explain the difference between visibility:hidden; and display:none?
Visibility:Hidden; - It is not visible but takes up it's original space.
Display:None; - It is hidden and takes no space.


Question: How do you clear a floated element?
clear:both


Question: What is the difference between == and === ?
== is equal to
=== is exactly equal to (value and type)



Question: What is a java script object?
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.



Question: Describe what "this" is in JavaScript?
this refers to the object which 'owns' the method.



Question: What is a closure?
Closures are expressions, usually functions, which can work with variables set within a certain context.


Question: 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



Question: What is Difference between null and undefined?
null is an object with no value. undefined is a type.
typeof null; // "object"  
typeof undefined; // "undefined"  



Question: What is the difference between HTML and XHTML?
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.