Web Front End Developer Interview Questions and Answers

What are the frequently asked interview questions for web front-end interviews

Web front-end frequently asked interview questions and answers

I. HTML+CSS

1. Understanding and awareness of WEB standards as well as the W3C

Tag closure, lowercase tags, no messy nesting, improve the chances of search robots to search for them, use of external

Care, easy revamping, no need to change the page content, provide a printable version without copying the content, to improve the ease of use of the site;

2. What is the difference between xhtml and html

HTML is a basic WEB web page design language, XHTML is an XML-based markup language

Most of the main differences:

XHTML elements must be properly nested.

XHTML elements must be closed.

Tag names must be in lowercase.

XHTML documents must have a root element.

3. Doctype?Strict mode vs. mixed mode – How are these two modes triggered and what is the significance of distinguishing between them?

Used to declare that the document uses the kind of specification (html/Xhtml) generally strict excessive frame-based html documents

Add XMl declaration can be triggered, the parsing mode changed to IE5.5 have IE5.5 bugs

4. What are the block-level elements?The box model of CSS?

Block-level elements: divph1h2h3h4formul

Inline elements: abbrispaninputselect

Css box model: content, border,margin,padding

5. The difference between link and @import?

Inline inline external link import

Difference: loaded at the same time

No compatibility with the former, the latter CSS2.1 browsers do not support

Link support the use of javascript to change the style of the latter can not be

6.CSS selector what? Which properties can be inherited? How is the priority algorithm calculated? Inline or important which has the highest priority?

Tag selector class selector id selector

Inheritance is not as good as specifying Id>class>tag selector

The latter has a high priority

7. What are the three layers of a front-end page and what are they? What are their roles?

Structural layer Html representation layer CSS behavior layer js

8. css basic statement composition is?

selector{property1:value1;property2:value2;……}

9. In which browsers have you tested the pages you made? What are the kernels of each of these browsers?

Ie (Ie kernel) Firefox (Gecko) Google (webkit) opear (Presto)

Two, Javascript

1. javascript typeof return which data types

Objectnumberfunctionbooleanunderfind

2. Example of 3 forced type conversions and 2 implicit type conversions?

Forced(parseInt,parseFloat,number)

Implicit(==-====)

3. split() join() difference

The former is to cut into the form of arrays, and the latter is to convert arrays into strings

4. . array methods pop() push() unshift() shift()

Push() tail add pop() tail delete

Unshift() head add shift() head delete

5. what is the difference between event binding and normal events

6. IE and DOM event streams The difference between IE and DOM event streams

1. the order of execution is not the same,

2. the parameters are not the same

3. the event plus or minus on

4. this points to the problem

7. what is the compatibility between IE and the standard under the writing

Varev=ev||window.event

document.documentElement.clientWidth||document.body.clientWidth

Vartarget=ev.srcElement||ev.target

8.ajax request when get and post The difference between get and post in ajax request

One after the url and one inside the virtual carrier

Size limitation

Security issues

Different applications, one for forums and so on that only need to be requested, and one for something like changing a password

9. The difference between call and apply

Object.call( this,obj1,obj2,obj3)

Object.apply(this,arguments)

10.ajax request, how to interpret the json data

Use evalparse in view of the security considerations to use parse more reliable

11.b Inherit a method

12. Write a function to get non-interline style

functiongetStyle(obj,attr,value)

{

if(!value)

{

if(obj.currentStyle)

{

returnobj.currentStyle(attr)

}

else

{

obj.getComputedStyle(attr,false)

}

}

}

else

{

obj.style[attr]=value

}

}

}

Web Front End 5 Interview Questions

1.Please explain the relationship between ECMAScript,JavaScript,Jscript?

ECMAScript provides the rules,

details and guidelines that scripting languages must follow and is the specification for scripting languages.

For example: ES5, ES6 are specific one-js versions.

JavaScript is a fork of ECMAScript,

JavaScript implements most of the ECMAScript specifications described in ECMA-262

with a few differences.

JScript is Microsoft’s

implementation of the ECMA-262 language specification, and with a few exceptions (which are intended to maintain backward compatibility),

Microsoft claims that JScript fully implements the ECMA standard.

Relationship:

JavaScript and JScript are ECMAScript version of the branch,

The two in the syntax is not much difference;

Only one of the company’s NetScape, a Microsoft;

IE series is the default of the JScript, and other

2. What events may be triggered during page load? What is their order?

When the page is loaded, it can be roughly divided into the following steps: 1) start parsing the HTML document structure 2) load external style sheets and JavaScript scripts 3) parse the execution of JavaScript scripts 4) rendering of the DOM tree is complete 5) load the unfinished external resources 6) the page is loaded successfully

Execution sequence:1) documentreadystatechange event2)documentDOMContentLoaded event3)windowload event

3.Does using a before declaring the variable a in a function generate an error? Why?

No, JS is able to do variable scope elevation,

elevating all variable and function declarations to the top of the current

scope, but not assigning values;

so it may result in the value being undefined.

4. What is hash, and the hashchange event?

First, let’s understand what hash is: hash is the part of the URL after the “#” character.

a) When you visit a web page with a browser,

if the web page has a hash in the URL,

the page will be positioned at the location of the element whose id (or name)

is the same as the hash value;

b) hash has another feature,

it’s not going to cause a reload of the page if it’s changed;

c) the page is not going to be reloaded if you change it;

c) the page is going to be reloaded if you change the URL.

c)The hash value is not sent to the server side by the browser along with the request;

d)Getting and setting the hash value is done through the window.location.hash property.

Changes in window.location.hash value will directly

react to the browser address bar (the part after # will change), and at the same time, changes in the browser address bar hash value will trigger

changes in window.location.hash value,

which triggers the onhashchange event.

Learn more about what a hashchange event is:

a) When the fragment identifier of a URL changes,

the hashchange event will be triggered (the part of the URL that follows the # symbol, including the # symbol) b)

When the hashchange event is triggered,

the event object will have the attributes URL before hashchange (oldURL) and URL after hashchange (newURL).

5. What is CDN, what is the significance of CDN for a website, and what kind of disadvantages does it have?

CDN is also known as Content Delivery Network; the intention is to

as far as possible to avoid the bottlenecks and links on the Internet that may affect the speed and stability of data

transmission,

so that the content is transmitted faster and more stable.

Main Purpose:

To solve the problem of access delay due to distribution, bandwidth, server performance,

Suitable for site acceleration, on-demand, live broadcasting and other scenarios.

Enables users to get the content they need nearby, solves Internet network congestion,

Improves the responsiveness and success rate of users accessing websites.

Disadvantages:

a) the implementation of complex, large investment;

b) most of the current CDN is still only for static content acceleration,

the effect of dynamic acceleration is not good;

and the effect of dual-line dynamic acceleration and static is the same.

2020 Web front-end interview questions summary (I)

Today I want to share with you the article is about 2020 Web front-end interview questions summary. Due to the content of more small separate for you to introduce, today, first of all to take a look at the first part of the content with the editor, I hope that these interview questions can be prepared to look for Web front-end related work of the small partners to help.

1. Say a few basic norms for writing JavaScript?

1)Don’t declare multiple variables on the same line;

2)Please use ====/! == to compare true/false or values;

3)Use object literals instead of newObject;

4)Reduce the use of global functions, global variables;

5)Switch statements must be with a default branch;

6)If statements must be in curly braces;

7)Variables in for-in loops;

Scopes should be explicitly qualified using the var keyword;

thereby avoiding global contamination of scopes.

2. What about balanced binary trees?

Self-balancing binary search tree (Self-balancingbinarysearchtree)

Also known as AVL tree.

Has the following properties:

1) It is an empty tree or its left and right subtrees

have a height difference whose absolute value does not exceed 1,

and both left and right subtrees are a balanced binary tree.

2) A balanced binary tree must be a binary search tree and vice versa.

3)Common implementations of balanced binary trees are Red-Black Tree, AVL,

Scapegoat Tree, Treap, Stretch Tree, and so on.

The formula for the nodes of a minimum binary balanced tree is as follows:

F(n)=F(n-1)+F(n-2)+1 Remarks: 1 is the root node,

F(n-1) is the number of nodes in the left subtree,

F(n-2) is the number of nodes in the right subtree.

3. Solution for clearing floats and solving overlapping vertical outer margins?

Problem description:

1)The parent element does not set the width and height, and the size is held up by the child element;

Once the child element is floated, the height of the parent element collapses.

2)The child element set margin-top will act on the parent element’s margin-top;

this will cause the vertical margins to overlap.

.clearfix::after,.clearfix::before{

content:”;

display:table;

clear:both;

}

4. broadband waste;

xxxstorage will save the data

locally, which will not cause broadband waste;

2)Different data storage sizes

Cookie data can’t be more than 4K, which applies to session identifier;

xxxstorage data storage can be 5M;

3)Different validity period of data storage

3)Different validity period of data storage

Data storage is not the same.

Cookies and localStorage are shared in the same source and window

;

sessionStorage is not shared in different browser windows

even on the same page;

5.

A palindrome is a scenario in which the same words or sentences,

are switched or reversed in the following text,

producing a first and last loop,

is called a palindrome, or refrain.

For example, cacac, redivider.

letcheckPalindrom=(str)=>{

returnstr===

str.split(”).reverse().join(”);

}

6. Swap two integers without the help of temporary variables?

Input a=3,b=1,

Output a=1,b=3

letswap=(a,b)=>{

b=b-a;

a=a+b;

b=a-b;

return[a,b];

}

7. Write at least 5 new tags added to html5 with their semantics and application scenarios?

section: defines a section of a document;

nav: defines a section that contains only navigational links;

header: defines the header of a page or section;

It often contains the logo, page title, and navigational table of contents.

footer: defines the footer of a page or section;

it often contains copyright information, links to legal information, and addresses for feedback and suggestions.

aside: defines content that is less relevant to the content of the page;

if it is deleted, the remaining content still makes sense.

8. What is the difference between get and post requests in terms of caching?

Get requests are similar to the lookup process, where the user gets the data,

and can use caching without having to connect to the database every time.

post is different, post does the work of modifying and deleting in general,

so it must interact with the database, so it can’t use cache.

So get requests are suitable for request caching.

9. How to solve asynchronous callback hell?

promise, generator, async/await

10. lazy loading and preloading of images?

Preloading: loading images in advance,

which can be rendered directly

from the local cache when the user needs to view them.

Lazy loading: the main purpose of lazy loading

is to serve as an optimization for the server front-end,

reducing the number of requests or delaying the number of requests.

The essence of the two techniques:

The behavior of the two is opposite,

one is to load early,

one is to load late or even not.

Lazy loading has some

stress-relieving effect on the server front-end,

while preloading increases server front-end stress.

11. What is the difference between bind, apply, and call?

Through apply and call to change the function of this pointing,

The first parameter of these two functions are the same,

said to change the pointing to the object,

The second parameter, apply is an array,

and call is arg1,arg2 …. This form.

Changing the scope of this by bind

returns a new function,

which is not executed immediately.

12. How does js control loading an image one at a time and then loading the next one when it’s done?

Method 1:

varobj=newImage();

obj.src=”#/21.jpg”;

obj.onload=function(){

document.getElementById(“pic”)

.innnerHTML=”“;

}

Loading

Method 2:

varobj=newImage();

obj.src=”#/21.jpg”;

obj. onreadystatechange=function(){

if(this.readyState==”complete”){

document.getElementById(“pic”)

.innnerHTML=”< imgsrc>“;

}

}

Loading