1. What are the values of y and z?

var x = 1; var y = 0; function add(n){n=n+1; } y = add(x); console.log(y);

Answer: undefined

Cause: There is no return value.

// declare a function expression

var add = function(x){ var sum = 1; Var TMP = function(x){sum = sum + x; // sum TMP; Tmp.tostring = function(){return sum; } return tmp; } console.log(add(100)(2)(3);} console.log(add(100)(2)(3);} console.log(add(100)(2)(3);

Answer: 5

3, javascript is object-oriented, how to reflect the javascript inheritance relationship?

Reference answer:

1. The prototype chain

Basic idea: Use stereotypes to make one reference type inherit the properties and methods of another.

The relationship between constructors, stereotypes, and instances: Each constructor has a stereotype object, which contains a pointer to the constructor, and each instance contains an internal pointer to the stereotype object.

Prototype chain implementation inheritance example:

function SuperType() { this.property = true; } SuperType.prototype.getSuperValue = function() { return this.property; } function subType() { this.property = false; } / / inherited SuperTypeSubType prototype = new SuperType (); SubType.prototype.getSubValue = function (){ return this.property; } var instance = new SubType(); console.log(instance.getSuperValue()); //true

2. Borrow constructors

Basic idea: The superclass constructor is called inside the subtype constructor, and the constructor can be executed on the newly created object by using the call() and apply() methods

Example:

function SuperType() { this.colors = [“red”,”blue”,”green”]; } function SubType() { SuperType.call(this); Var instance1 = new SubType(); instance1.colors.push(“black”); console.log(instance1.colors); //”red”,”blue”,”green”,”black” var instance2 = new SubType(); console.log(instance2.colors); //”red”,”blue”,”green”

Form input can be set to readonly or disable.

Reference answer:

Readonly is not editable, but can be selected and copied; Values can be passed to the background disabled cannot be edited, selected, or copied; Values cannot be passed to the background

5. What is the difference between javaScript’s two variable ranges?

Reference answer:

Global variables: valid local variables within the current page: valid global scope and block-level scope within the method

6. How to catch exceptions in the program?

Reference answer:

window.error

try{}catch(){}finally{}

7, write the results of the program?

for(i=0, j=0; i<10, j<6; i++, j++){

k = i + j;

}

console.log(k);

Answer: 10

8. What are the three layers of the front page? What does it do?

Reference answer:

Structure layer Html(page structure content, skeleton) Presentation layer CSS(style and appearance of web pages) Behavior layer JS (interaction of web pages, animation effects)

9. What is the difference between the title and Alt attributes on a tag?

Reference answer:

Alt is an image attribute that lets search engines recognize your image. Display when the image is not displayed. Title is the title of your website and is the most important attribute in SEO.

How to optimize web page loading speed?

** :

Reduce HTTP requests 2. Compress components 3. Put scripts at the bottom 4. Avoid CSS expressions 5. Use external JavaScript and CSS

11. Which front-end frameworks have been used and which are suitable for mobile terminals, and briefly describe their advantages and disadvantages.

Reference answer:

1.Bootstrap is the most widely used framework. Has the most comprehensive features, and can quickly customize their own projects. 2.Foundation is an advanced responsive front-end framework that can be tailored to your specific needs, which makes it easy to develop multiple layouts, and mobile versions and desktop devices use the same markup. 3.UI Kit, developed based on Less, is a lightweight and modular front-end framework, which can quickly build a powerful Web front-end interface and provide comprehensive HTML, CSS and JS components, easy to use and easy to customize. Pure comes from A set of CSS modules from Yahoo that can be used as a base for Web projects and is very small. 5. With the concept of Mobile First, Amaze UI will gradually expand from small screen to large screen, and finally realize all screen adaptation to adapt to the trend of Mobile Internet.

12, return, return false, return true

Reference answer:

return true; Return false; Error processing result returned; Termination processing; Prevent form submission; Prevents execution of default behavior. Return; Return control to the page.

At present, some problems are probably these, the important are written down, not important, anyway, are all nonsense how how cowhide.

You have time can go to my blog to increase IP+1 good card ah

blog