JavaScript face questions

Source: Internet
Author: User
Tags browser cache

What data types are returned by the typeof of 1.javascript

  • Object number String function Boolean underfind;

2. Examples of 3 coercion type conversions and 2 implicit type conversions?

  • Mandatory (Parseint,parsefloat,number) implicit (==–*/);

3. Array method Pop () push () unshift () Shift ()

  • Push () trailing add pop () trailing delete

  • Unshift () header add Shift () header Delete

What is the difference between the Get and post modes when 4.ajax requests?

  • One in the back of the URL and placed inside the virtual carrier
    There is a capacity size limit

  • Security issues
    Application of a different one is the forum and so on only need to request, one is similar to change the password;

  • Get cache is suitable for collection and sharing

The difference between 5.call and apply

  • Object.call (THIS,OBJ1,OBJ2,OBJ3)

  • Object.apply (this,arguments)

How to interpret JSON data when 6.ajax requests

  • Using the Eval parse, the use of parse is more reliable in view of security considerations; Eval needs to be added (), eval (' (' +json+ ') ');

7. What is the event delegate?

  • Using the event bubbling principle, the event that you trigger, let his parent element take the place of execution!

8. What are closures and what are the characteristics that affect the page? A brief introduction to the closures you understand

  • Closures are child functions that can use local variables of the parent function.

9. Add Delete to replace the method inserted into a contact

Obj.appendchidl ()
Obj.innersetbefore ()
Obj.replacechild
Obj.removechild

10. What is JavaScript's homologous strategy?

  • A script can read only the properties of windows and documents from the same source, where the same source refers to a combination of host name, protocol, and port number

11. Preparation of a method of B inheriting A;

functionAthis.name = name; this.sayhello = functionthis.name+ "Say Hello!");}; function B  (name,id) {this.temp = A; this.temp (name); //equivalent to New A (); delete THIS.TEMP; this.id = ID; this.checkid = functionthis.id==id)};       

12. How to block event bubbling and default events

function stopBubble(e){   if (e && e.stopPropagation) e.stopPropagation() else window.event.cancelBubble=true}return false

13. What is the result of the following program execution?

functionfn () {THIS.A = 0; this.b = function () {alert (this.a)}}fn.prototype = {b: function () {THIS.A = 20; Alert (THIS.A);}, C: function< Span class= "Hljs-params" > () {THIS.A = 30; alert (THIS.A); }}var myfn = new fn (); myfn.b (); myfn.c ();     

14. Talk about the understanding of this object.

This is a keyword of JS, and the value of this will change as the function is used in different situations.
But there is a general principle that this refers to the object that invokes the function.
This is the general case: global object. As a method call, then this refers to this object

15. Results of the following procedure

functionfun (n,o) {console.log (o) return {fun:function (m) {return Fun (M,n);}};} var a = Fun (0), A.fun (1), A.fun ( Span class= "Hljs-number" >2); A.fun (3); 0). Fun (1). Fun (2). Span class= "Hljs-number" >3); var C = Fun (0). Fun (1); C.fun (2); C.fun (3);             

Answer:
a:undefined,0,0,0
b:undefined,0,1,2
c:undefined,0,1,1

16. Output of the following program

var name = ‘World!‘;(function () { if (typeof name === ‘undefined‘) { var name = ‘Jack‘; console.log(‘Goodbye ‘ + name); } else { console.log(‘Hello ‘ + name); }})();

17. Do you know node? What are the usage scenarios for node?

  • High concurrency, chat, real-time message push

18. Introduce your most used framework

  • Jquery,rn,angular, etc.;

19. Do you know anything about the front-end automation build tool? Simply introduce

  • Gulp,grunt, etc.;

20. Describe the backend language you know and the level of mastery

Other



1. Put forward your own views on node's strengths and weaknesses?

Advantages

 因为Node是基于事件驱动和无阻塞的,所以非常适合处理并发请求, 因此构建在Node上的代理服务器相比其他技术实现(如Ruby)的服务器表现要好得多。此外,与Node代理服务器交互的客户端代码是由javascript语言编写的,因此客户端和服务器端都用同一种语言编写,这是非常美妙的事情。

Disadvantages

2. What are your performance optimization methods?

(1) Reduce the number of HTTP requests: CSS Sprites, JS, CSS source compression, picture size control appropriate; web Gzip,cdn hosting, data caching, image server.
(2) Front-end template js+ data, reduce the bandwidth wasted due to HTML tags, front-end with variables to save AJAX request results, each operation of local variables, no request, reduce the number of requests
(3) using innerHTML instead of DOM operation, reduce DOM operation times and optimize JavaScript performance.
(4) When you need to set a lot of styles, set classname instead of manipulating the style directly.
(5) Reduce the use of global variables, cache DOM node lookup results. Reduce IO read operations.
(6) Avoid using CSS expression (CSS expressions), also known as dynamic properties.
(7) Pre-load the picture, put the style sheet at the top, and put the script at the bottom of the timestamp.
(8) Avoid using table,table in the main layout of the page to wait for the content to be fully downloaded before it is displayed, showing that the div+css layout is slow. For the common web site has a unified thinking, is to maximize the front-end optimization, reduce database operations, reduce disk IO. To the front-end optimization refers to, without affecting the functionality and experience, can be performed in the browser do not perform on the server, can be directly returned on the cache servers do not go to the application server, the program can directly obtain the results do not go to the external acquisition, the data obtained from the machine to remote access, memory can not be taken to the disk, Do not go to database queries in the cache. Reducing database operations means reducing the number of updates, caching the results by reducing the number of queries, and doing the operations of the database as much as possible with your program (for example, join queries), reducing disk IO by minimizing the use of the file system as a cache, reducing the number of read and write files, and so on. Program optimization should always optimize the slow part, in order to change the language is not "optimized".

What are the 3.http status codes? What does it mean to be represented separately?

100-199 is used to specify certain actions that the client should be corresponding.
200-299 is used to indicate a successful request.
300-399 is used for files that have been moved and is often included in the locator header information to specify the new address information.
400-499 is used to indicate client-side errors. 400 1, the semantic error, the current request can not be understood by the server. 401 the current request requires the user to verify that the 403 server has understood the request, but refuses to execute it.
500-599 is used to support server errors. 503– Service Not available

4. A page from the input URL to the page load display completed, what happened in this process? (The more detailed the process, the better)

  • Find browser cache

  • DNS resolves, locates the IP address of the domain name, redirects (301), and issues a second GET request

  • Making an HTTP protocol session

  • Client Send header (request header)

  • Document Start download

  • Document Tree establishes a file that specifies the MIME type required according to the tag request

  • File display

  • The work done on this side of the browser is broadly divided into the following steps:

  • Load: According to the URL of the request for Domain name resolution, to the server to initiate requests, receive files (HTML, JS, CSS, images, etc.).

  • Parsing: syntax parsing of loaded resources (HTML, JS, CSS, etc.), suggesting corresponding internal data structures (such as HTML DOM tree, JS (object) attribute table, CSS style rules, etc.)

5. What are your common development tools and why?

  • sublime,atom,nodepad++;

6. Tell me about some of the most popular things lately? Which websites do you often visit?

  • node. js, MVVM, React-native,angular,weex, etc.

  • Csdn,segmentfault, Blog Park, StackOverflow, etc.

JavaScript face questions

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.