Summary of front end interview questions - JS (under continuous update)

JavaScript language 2020-11-13 05:04:16
summary end interview questions js


Summary of front-end interview questions ——JS( Ongoing update )

1.javascript Of typeof What data types are returned

Object number function boolean underfind string

2. enumerate 3 Cast and 2 Types of implicit type conversions ?

mandatory (parseInt,parseFloat,number)
Implicit (== - ===)

3.split() join() The difference between

The former is cut into arrays , The latter is to convert an array into a string

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

Unshift() Add... To the head shift() Head delete
Push() Tail add pop() Tail delete

5.IE and DOM The difference between event flows

1. The execution order is different 、
2. The parameters are different
3. Event plus or not on
4.this Point to the problem

6.IE What are the compatible writing methods with the standard

Var ev = ev || window.event
document.documentElement.clientWidth || document.body.clientWidth
Var target = ev.srcElement||ev.target

7.ajax On request get and post Differences in methods

1. In a url Back One in a virtual carrier
2. There's a size limit
3. safety problem
4. Different applications One is forum, etc., which only needs to be requested , One is similar to changing the password

8.call and apply The difference between

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

9.ajax When asked , How to parse json data

Use eval parse For security reasons Use parse More reliable

10. Write a function to get the non line style

function getStyle(obj, attr, value) {
if(!value) {
if(obj.currentStyle) {
return obj.currentStyle(attr)
}
else {
obj.getComputedStyle(attr, false)
}
}
else {
obj.style[attr]=value
}
}

11. Event delegation ( agent ) What is it?

Let's use the principle of event bubbling , Let your own triggered events , Let his parent element take the place of execution !

12. What is a closure , What are the characteristics , What's the impact on the page

Closures are functions that can read internal variables of other functions .
http://blog.csdn.net/gaoshanw… ( It's not a company that asked this question )
You can also click here to see the previous article on closures

13. How to prevent event bubbling and default Events

stoppropagation / preventdefault

14. add to Insert Replace Method of deleting to a point

obj.appendChidl()
obj.innersetBefore
obj.replaceChild
obj.removeChild

15. explain jsonp Principle , And why not really ajax

Dynamically create script label , Callback function
Ajax Is the page no refresh request data operation

16.javascript Local objects for , Built in and host objects

The local object is array obj regexp You can wait new Instantiation
The built-in object is gload Math Can't be instantiated
The host is the browser's own document,window etc.

17.document load and document ready The difference between

There are two kinds of events when the page is loaded :
One . yes ready, Indicates that the document structure has been loaded ( Do not include non text media files such as pictures ).
Two . yes onload, Indicates that all elements of the page, including images and other files, are loaded .

18.”” and “=” Different

The former will automatically convert the type
The latter will not.

19.javascript The same origin strategy

The concept of homology is very important , It is of great significance in ensuring the security of data ,
A script can only read the properties of windows and documents from the same source , The same source here refers to the agreement 、 Combination of domain name and port number

20. The fastest array to maximize

var arr = [ 1,5,1,7,5,9];
Math.max(...arr) // 9

21. Shorter array de rewriting

[...new Set([2,"12",2,12,1,2,1,6,12,13,6])]
// [2, "12", 12, 1, 6, 13]

22. Sorting algorithm

Ascending :

var numberArray = [3,6,2,4,1,5];
numberArray.sort(function(a,b){
return a-b;
})
console.log(numberArray);

23. Bubble sort

var examplearr=[8,94,15,88,55,76,21,39];
function sortarr(arr){
for(i=0;i<arr.length-1;i++){
for(j=0;j<arr.length-1-i;j++){
if(arr[j]>arr[j+1]){
var temp=arr[j];
arr[j]=arr[j+1];
arr[j+1]=temp;
}
}
}
return arr;
}
sortarr(examplearr);
console.log(examplearr);

24.null and undefined The difference between :

null: It means no value ;undefined: Represents an undeclared variable , Or a variable that has been declared but not assigned ,
An object does not exist .

25. A point to note about using closures :

1. Because closures keep variables in functions in memory , Memory consumption is high , So you can't abuse closures , Otherwise it will cause performance problems , stay IE May cause memory leaks in . The solution is , Before exiting the function , Delete all unused local variables .

2. The closure will be outside the parent function , Change the value of the internal variable of the parent function . therefore , If you take the parent function as an object (object) Use , Use closures as its common method (Public Method), Treat internal variables as their private properties (private value), Be careful at this time , Don't change the value of the internal variable of the parent function . 
( About closure , For more information JavaScript The scope and closure of )

26. Please explain JSONP How it works , And why it's not really AJAX.

JSONP (JSON with Padding) Is a simple and efficient cross domain approach ,HTML Medium script Tags can be loaded and executed in other domains javascript, So we can go through script Tag to dynamically load resources from other domains . For example, I want to be from domain A The page of pageA Load fields B The data of , So in domain B The page of pageB I use JavaScript A formal statement of pageA Data required , And then in pageA of use script Label the handle pageB Loading in , that pageB The script in will be executed .JSONP On this basis, a callback function is added ,pageB After loading, it will execute pageA The function defined in , The required data is passed to the function as parameters .JSONP Easy to implement , But there are also some security risks , If a third-party script is executed at will , Then it can tamper with the content of the page , Intercept sensitive data . But passing data between trusted parties ,JSONP It's a very suitable choice .

AJAX It's not cross domain , and JSONP It's a cross domain , In addition, the two receive parameters in different forms !

27. Explain the variable declaration promotion .

At function execution time , Raise the declaration of variables to the top of the function , And its value definition is still in its original position .

28. How to get from the browser's URL Get the query string parameter from the .

The following function will get a key Parameters of .

 function parseQueryString ( name ){
name = name.replace(/[\[]/,"\\\[");
var regexS = "[\\?&]"+name+"=([^&#]*)";
var regex = new RegExp( regexS );
var results = regex.exec( window.location.href );
if(results == null) {
return "";
} else {
return results[1];
}
}

29.arguments What is it? ?

arguments Although there are some array properties , But it's not really an array , It's just a class array object .
It doesn't have many methods of arrays , You can't call... Like a real array .jion(),.concat(),.pop() Other methods .

30. What is? ”use strict”;? What are the advantages and disadvantages of using it ?

The expression appears in the code -“use strict”; It means that the code is parsed in a strict pattern , This pattern makes Javascript Operate under more stringent conditions .

benefits :
1. eliminate Javascript Some unreasonable grammar 、 Not rigorous , Reduce some weird behavior ;
2. Eliminate some insecurity of code running , Ensure the safety of code operation ;
3. Improve compiler efficiency , Increase running speed ;

Disadvantage :
1. Same code , stay ” Strict mode ” in , There may be different running results ; Some are ” Normal mode ” Next statement that can be run , stay ” Strict mode ” Next will not run .

31. What is a callback function ?

1. It's a function call process . So start by understanding the calling process .
function a There is a parameter , This argument is a function b, Function as a Execute the function after execution b. So this process is called callback .

2. Another explanation : In the process of developing the website , We often come across something that takes a long time javascript operation . among , There are asynchronous operations ( such as ajax Read server data ), There are also synchronous operations ( For example, traversing a large array ), They don't have immediate results . 
The usual way is , Specify callback functions for them (callback). That is to say, to stipulate in advance , Once they're done , Which functions should be called .

32. Use typeof bar === “object” Judge bar Is it a potential disadvantage of a target ? How to avoid this kind of malpractice ?

let obj = {};
let arr = [];
console.log(typeof obj === 'object'); //true
console.log(typeof arr === 'object'); //true

From the above output, we can see that ,typeof bar === “object” It's not accurate to judge bar It's just one. Object. Can pass Object.prototype.toString.call(bar) === “[object Object]” To avoid this kind of malpractice :

let obj = {};
let arr = [];
console.log(Object.prototype.toString.call(obj)); //[object Object]
console.log(Object.prototype.toString.call(arr)); //[object Array]

33. What the following code will output ? Why? ?


console.log(1 + "2" + "2"); //122
console.log(1 + +"2" + "2"); //32
console.log(1 + -"1" + "2"); //02
console.log(+"1" + "1" + "2"); //112
console.log( "A" - "B" + "2"); //NaN2
console.log( "A" - "B" + 2); //NaN
console.log('3' + 2 + 1);//321
console.log(typeof +'3'); //number
console.log(typeof (''+3)); //string
console.log('a' * 'sd'); //NaN

34. Logical operations

Or logic : When 0 In front of console.log((0|| 2)); Then the output is the following number , by 2;

 Dang Jie 0 When you think the number is ahead console.log((2|| 0)); The output of 2;

And logic : When there is 0 when console.log(0&&2 ); Then the output is 0;

 When it doesn't exist 0 when ,console.log(1&&2 ); Then the output is the next one , by 2;
console.log(2&&1 ); The output of 1;

35. stay JavaScript, common false value :

0, ‘0’, +0, -0, false, ‘’,null,undefined,null,NaN

Pay attention to empty arrays ([]) And empty objects ({}):


console.log([] == false) //true
console.log({} == false) //false
console.log(Boolean([])) //true

36. Explain the output of the following code

 var a={},
b={key:'b'},
c={key:'c'};
a[b]=123;
a[c]=456;
console.log(a[b]);

Because when setting object properties ,JS Will implicitly stringify Parameter values .
In this case , because b and c Are all objects , They will all be converted into “[object object]”.
therefore ,a[b] and [c] Are equivalent to [[object object]], And it can be used interchangeably .
therefore , Set or reference [c] With settings or references a[b] Exactly the same .`

37. Explain the output of the following code

(function(x) {
return (function(y) {
console.log(x);
})(2)
})(1);

Output 1, Closures can access variables or parameters of an external scope .

38. Please write the following output :

function Foo() {
getName = function () { alert (1); };
return this;
}
Foo.getName = function () { alert (2);};
Foo.prototype.getName = function () { alert (3);};
var getName = function () { alert (4);};
function getName() { alert (5);}
Foo.getName(); //2
getName(); //4
Foo().getName(); //1
getName(); //1
new Foo.getName(); //2
new Foo().getName(); //3
new new Foo().getName(); //3

39. Talk to you about Ajax The understanding of the ?( Concept 、 characteristic 、 effect )

AJAX Its full name is “Asynchronous JavaScript And XML”( asynchronous JavaScript and XML) It refers to a development technology for creating interactive web applications 、 Improve user experience , Achieve no refresh effect .

advantage

a、 Plug in support not required  
b、 Excellent user experience  
c、 Improve Web The performance of the program  
d、 Reduce the burden of servers and bandwidth

shortcoming

a、 Breaking the browser “ Forward ”、“ back off ” The normal function of the button , It can be made up with simple plug-ins  
b、 Lack of support for search engines

40. Talk about your delay object deferred The understanding of the ?

a、 What is? deferred object

In terms of callback functions ,jQuery Is very weak . To change that ,jQuery The development team designed deferred object . 
In short ,deferred Object is jQuery The callback function solution of . In English ,defer It means ” Delay ”, therefore deferred The meaning of an object is ” Delay ” Do it at some point in the future . 
It solves the problem of how to deal with time-consuming operations , Better control over those operations , And a unified programming interface .

b、 Its main function , It can be summed up in four points :

(1)、 Realize chain operation  
(2)、 Specifies multiple callback functions for the same operation  
(3)、 Specify callback functions for multiple operations  
(4)、 Callback function interface for normal operations

41. What is cross-domain , How to achieve cross domain access ?

Cross domain refers to the mutual access between different domain names . 
JavaScript Restriction of homologous strategy ,A Domain name JavaScript Can't operate B or C The object under the domain name

Realization :

(1)、JSONP Cross domain : utilize script Scripts allow references to... In different domains js Realized , Bring the callback method to the server , Call back when the result is returned . 
1 adopt jsonp Cross domain

 1. Native implementation :
<script>
var script = document.createElement('script');
script.type = 'text/javascript';
// Pass the parameter and specify the callback execution function as onBack
script.src = 'http://www.....:8080/login?user=admin&callback=onBack';
document.head.appendChild(script);
// Callback execution function
function onBack(res) {
alert(JSON.stringify(res));
}
</script>
2.document.domain + iframe Cross domain
This scheme only applies to the same primary domain , Different cross domain application scenarios of sub domains .
1. The parent window :(http://www.domain.com/a.html)
<iframe id="iframe" src="http://child.domain.com/b.html"></iframe>
<script>
document.domain = 'domain.com';
var user = 'admin';
</script>
2. child window :(http://child.domain.com/b.html)
<script>
document.domain = 'domain.com';
// Gets a variable in the parent window
alert('get js data from parent ---> ' + window.parent.user);
</script>
disadvantages : Take a look at the following rendering load optimization
1、 nginx Agent cross domain
2、 nodejs Middleware agent cross domain
3、 The back end sets the security domain name in the header information

(3)、 Cross-domain resource sharing (CORS) 
Cross-domain resource sharing (CORS) Is a technical specification for web browsers , It's for Web The server defines a way , Allow web pages to access their resources from different domains .

CORS And JSONP comparison :

a、JSONP Can only achieve GET request , and CORS Support all types HTTP request . 
b、 Use CORS, Developers can use ordinary XMLHttpRequest Request and get data , Compared with JSONP Better error handling . 
c、JSONP Mainly supported by old browsers , They often don't support CORS, And most modern browsers already support CORS.
For more details on cross domain, please see  https://segmentfault.com/a/11…

42. Why use a template engine ?

a. template engine ( This is especially for Web Developed template engine ) For user interface and business data ( Content ) The result of separation , It can generate documents in a specific format , The template engine for the site will generate a standard HTML file . 
b. In some examples javascript A large number of html character string ,html Some of them are like onclick What kind of javascript, such javascript There is html,html There is javascript, Code coupling is very high , Not easy to modify and maintain , Using template engine can solve the problem .

43. According to your understanding , Please briefly JavaScript How scripts work ?

JavaScript It's a dynamic 、 Weak type 、 Prototype based language , It can be executed directly through the browser . 
When the browser encounters

44.JavaScript What are the data types of ?

Basic data type : character string String、 Numbers Number、 Boolean Boolean 
Composite data type : Array Array、 object Object 
Special data types :Null An empty object 、Undefined Undefined

45.ionic and angularjs The difference between ?

a、ionic It's a hybrid mobile app , Open source , Free code base . Can be optimized html、css and js Performance of , Building efficient applications , And it can also be used to build Sass and AngularJS The optimization of the . 
b、AngularJS Extended with new properties and expressions HTML.AngularJS You can build a single page application (SPAs:Single Page Applications). 
c、Ionic It's a hybrid APP development tool , It uses AngularJS For intermediate scripting tools ( It's called a library , It doesn't seem appropriate ), therefore , If you want to use Ionic Development APP, You have to understand AngularJS.

46. Talk about your understanding of closures ?

(1)、 Closures are mainly used to design private methods and variables . The advantage of closures is that they can avoid the pollution of global variables ,
The disadvantage is that closures are memory resident , Increases memory usage , Improper use can easily cause memory leakage .

(2)、 Closures have three characteristics : 
a、 Function nested function  
b、 Functions can reference external parameters and variables internally  
c、 Parameters and variables are not recycled by the garbage collection mechanism

47. Talk about you This Understanding of the object ?

Answer one :

(1)、js Of this The direction is uncertain , In other words, it can be changed dynamically .call/apply It's for change this Function pointed to , This design makes the code more flexible , More reusability  
(2)、this In general , All point to the owner of the function . 
(3)、 In function self execution ,this Pointing to window object .

Expand : About this, There's another thing that's a little fuzzy about it dom In the incident , There are usually the following 3 In this case : 
a、 Register events using tag properties , here this Pointing to window object . 
b、 To and a, Must let this Point to input, Can be this Pass as a parameter . 
c、 Use addEventListener Wait for the registration event . here this It's also a direction input.

Answer two :

(1)、 Under the global scope of this:

this;/*window*/
var a = {name: this}/*window*/
var b = [this];/*window*/

In global scope ,this The default point to window object .

(2)、 In a function this, It can be further divided into the following situations : 
a、 Generally defined functions , And then the general execution :

var a = function(){
console.log(this);
}
a();/*window*/

this Or default to window.

b、 General definition , use new Calls to perform :

var a = function(){
console.log(this);
}
new a();/* New empty object */

Now let's this Point to the new empty object , We can initialize our own variables for empty objects  
c、 Functions as object properties , Invocation time :

var a = {
f:function(){
console.log(this)
}
}
a.f();/*a object */

Now this To call f Functional a object . 
(3)、 adopt call() and apply() To change this The default reference of :

var b = {id: 'b'};
var a = {
f:function(){
console.log(this)
}
}
a.f.call(b);/*window*/

All function objects have call Methods and apply Method , Their usage is similar in general ,f.call(b); It means yes , perform f function , And will f In the active object during the execution of a function this Point to b object , In this way, when the identifier is parsed ,this It would be b Object . However, the calling function is to pass parameters . therefore ,f.call(b, x, y); f.apply(b, [x, y]); ok , The above is the use of call Method execution f function , And use apply Method execution f How to transfer parameters in function , The difference between them , It's clear at a glance :apply Pass the parameters through the array ,call Pass the parameters one by one . 
(4)、 Special execution of some functions this Direction problem of :

a、setTimeout() and setInverval():
var a = function(){
console.log(this);
}
setTimeout(a,0);/*window*/
setInterval() similar .

b、dom In the active object of the callback method that triggers the event in the model this Point to dom object .

48.JavaScript Several ways to create objects ?

(1) Factory mode

function Parent(){
var Child = new Object();
Child.name=" Tears into snow ";
Child.age="20";
return Child;
};
var x = Parent();

When referring to the object , What we use here is var x = Parent() instead of var x = new Parent(); Because the latter may have many problems ( The former has also become a classic way for factories , The latter is called the hybrid factory approach ), It is not recommended to use new How to use the object

(2) Constructor method

function Parent(){
this.name=" Tears into snow ";
this.age="20";
};
var x =new Parent();

(3) Archetypal model

function Parent(){
};
Parent.prototype.name=" Tears into snow ";
Parent.prototype.age="20";
var x =new Parent();

(4) Mixed constructors , Prototype way ( recommend )

function Parent(){
this.name=" Tears into snow ";
this.age=22;
};
Parent.prototype.lev=function(){
return this.name;
};
var x =new Parent();

(5) Dynamic prototyping

function Parent(){
this.name=" Tears into snow ";
this.age=22;
;
if(typeof Parent._lev=="undefined"){
Parent.prototype.lev=function(){
return this.name;
}
Parent._lev=true;
}
};
var x =new Parent();

49. Please write out js Memory leaks ?

Answer one :

(1)、IE7/8 DOM Circular references cause memory leaks  
a、 Multiple objects refer to  
b、 Loop yourself

(2)、 The basis of DOM leak  
When the original DOM When removed , If the child node reference is not removed, it cannot be recycled .

(3)、timer Timer leak  
You can't recycle at this time buggyObject, terms of settlement , First stop timer And then recycle it

Answer two :

A memory leak is any object that still exists after you no longer own or need it . 
The garbage collector scans objects regularly , And count the number of other objects that reference each object . If the number of references to an object is 0( No other object has referenced the object ), Or the only reference to the object is circular , Then the memory of the object can be recycled .

setTimeout If the first argument of is a string instead of a function , Can cause memory leaks . 
Closure 、 Console log 、 loop ( When two objects reference each other and keep each other , There will be a cycle ) It also causes memory leaks .

50.JS Where should I put it ?

(1)、 Placed on the bottom , Even if it's placed at the bottom, it will block all presentation , But it doesn't block resource downloads . 
(2)、 If embedded JS Put it in head in , Please insert JS Put it in CSS Head . 
(3)、 Use defer( Only support IE) 
(4)、 Don't embed JS A long run function is called in , If you must use , It can be used setTimeout To call

51. Please explain the bubble mechanism of events

a、 Trigger some kind of event on an object ( For example, click onclick event ), If this object defines a handler for this event , Then this event will call the handler , If this event handler or event return is not defined true, Then this event will propagate to the parent object of this object , From inside to outside , Until it's dealt with ( All events of the same kind of the parent object will be activated ), Or it reaches the top of the object hierarchy , namely document object ( Some browsers are window).

b、 Bubbling Events : Events are based on from the most specific event target to the least specific event target (document object ) In order to trigger

c、js Bubbling is when an element defines an event A, Such as click event , If the event is triggered , It didn't stop bubbling , Then the event will propagate to the parent element , Trigger the parent class click function .

// How to stop bubbling time , compatible ie(e.cancleBubble) and ff(e.stopProgation)

function stopBubble(e){
var evt = e||window.event;
evt.stopPropagation?evt.stopPropagation():(evt.cancelBubble=true);// To prevent a bubble
evt.preventDefault

51. Tell me about your right Promise The understanding of the ?

ES6 Native provides Promise object . 
So-called Promise, It's an object , Messages used to deliver asynchronous operations . It represents an event that will know the result in the future ( This is usually an asynchronous operation ), And this event provides a unified API, For further processing .

Promise Objects have the following two characteristics :

(1)、 The state of the object is not affected by the outside world .Promise The object represents an asynchronous operation , There are three states :Pending( Have in hand )、Resolved( Completed , also called Fulfilled) and Rejected( Failed ). Only results of asynchronous operations , You can decide which state you are in , No other operation can change this state . This is also Promise The origin of the name , It means the same thing in English 「 promise 」, Says nothing else can be changed .

(2)、 Once the status changes , It won't change , You can get that at any time .Promise Object state changes , There are only two possibilities : from Pending Turn into Resolved And from the Pending Turn into Rejected. As long as those two things happen , The state is frozen , It won't change , It's going to stay that way . Even if the change has already happened , You again to Promise Object to add a callback function , And you'll get that immediately . With the event (Event) Completely different , The characteristic of the event is , If you missed it , To listen again , You don't get results .

With Promise object , The asynchronous operation can be expressed as a synchronous operation flow , Avoid layers of nested callback functions . Besides ,Promise Objects provide a uniform interface , Makes it easier to control asynchronous operations .

Promise There are also some disadvantages . First , Can't cancel Promise, Once it's created, it's executed immediately , Unable to cancel . secondly , If you do not set the callback function ,Promise An error thrown internally , It doesn't react to the outside . Third , When in Pending In the state of , It is impossible to know at what stage ( Just started or almost finished ).

52. Tell me about the prototype (prototype) understand ?

JavaScript It's a language that inherits through prototypes. It's different from other high-level languages , image java,C# Inheritance is determined by type ,JavaScript Yes, dynamic weakly typed languages , In short, it can be said that JavaScript It's all objects in , stay JavaScript in , Prototype is also an object , The property inheritance of objects can be realized through prototypes ,JavaScript All of the objects contain a ” prototype” Internal attributes , This property corresponds to the prototype of the object .

“prototype” As an internal property of an object , It can't be accessed directly . So for the convenience of viewing the prototype of an object ,Firefox and Chrome Kernel JavaScript The engine provides ”proto“ This nonstandard accessor (ECMA The new standard introduces standard object prototype accessors ”Object.getPrototype(object)”).

The main function of prototypes is to implement inheritance and extension objects .

53. stay JavaScript in ,instanceof Used to determine whether an object is constructed by another function .

Use typeof There is a problem with using reference types to store values when using operators , No matter what type of object is referenced , It is returned “object”.ECMAScript Another one was introduced Java Operator instanceof To solve this problem .instanceof Operators and typeof Operators are similar , Used to identify the type of object being processed . And typeof The difference is ,instanceof Method requires the developer to explicitly confirm that the object is of a certain type .

54. Pure array sort

Bubbles and choices are common , Here use sort Sort

 export const orderArr=(arr)=>{
arr.sort((a,b)=>{
return a-b // take arr Ascending order , If it's in reverse order return -(a-b)
})
}

55. Array objects sort

export const orderArr=(arr)=>{
arr.sort((a,b)=>{
let value1 = a[property];
let value2 = b[property];
return value1 - value2;//sort Method takes a function as an argument , Here we nest a layer of functions with
// To receive the object property name , Other parts of the code and normal use sort In the same way
})
}
  1. Object traversal

export const traverseObj=(obj)=>{
for(let variable in obj){
//For…in Traversal objects include all inherited properties , So if
// Just want to use the properties of the object itself, you need to make a judgment
if(obj.hasOwnProperty(variable)){
console.log(variable,obj[variable])
}
}
}

57.promise

promise It is a reusable asynchronous task management mechanism that encapsulates future values , Mainly solve hell callback and control asynchronous order

1. Application method 1

export const promiseDemo=()=>{
new Promise((resolve,reject)=>{
resolve(()=>{
let a=1;
return ++a;
}).then((data)=>{
console.log(data)//data The value is ++a Value
}).catch(()=>{// Wrong execution of this
})
})
}

2. Application method two

export const promiseDemo=()=>{
Promise.resolve([1,2,3]).then((data)=>{// Initialize a directly Promise And implement resolve Method
console.log(data)//data The value is [1,2,3]
})
}

58. How to disable the right-click of web menu ?

<script>
function Click(){
window.event.returnValue=false;
}
document.oncontextmenu=Click;
</script>
Recovery method :javascript:alert(document.oncontextmenu='')
版权声明
本文为[JavaScript language]所创,转载请带上原文链接,感谢

  1. [front end -- JavaScript] knowledge point (IV) -- memory leakage in the project (I)
  2. This mechanism in JS
  3. Vue 3.0 source code learning 1 --- rendering process of components
  4. Learning the realization of canvas and simple drawing
  5. gin里获取http请求过来的参数
  6. vue3的新特性
  7. Get the parameters from HTTP request in gin
  8. New features of vue3
  9. vue-cli 引入腾讯地图(最新 api,rocketmq原理面试
  10. Vue 学习笔记(3,免费Java高级工程师学习资源
  11. Vue 学习笔记(2,Java编程视频教程
  12. Vue cli introduces Tencent maps (the latest API, rocketmq)
  13. Vue learning notes (3, free Java senior engineer learning resources)
  14. Vue learning notes (2, Java programming video tutorial)
  15. 【Vue】—props属性
  16. 【Vue】—创建组件
  17. [Vue] - props attribute
  18. [Vue] - create component
  19. 浅谈vue响应式原理及发布订阅模式和观察者模式
  20. On Vue responsive principle, publish subscribe mode and observer mode
  21. 浅谈vue响应式原理及发布订阅模式和观察者模式
  22. On Vue responsive principle, publish subscribe mode and observer mode
  23. Xiaobai can understand it. It only takes 4 steps to solve the problem of Vue keep alive cache component
  24. Publish, subscribe and observer of design patterns
  25. Summary of common content added in ES6 + (II)
  26. No.8 Vue element admin learning (III) vuex learning and login method analysis
  27. Write a mini webpack project construction tool
  28. Shopping cart (front-end static page preparation)
  29. Introduction to the fluent platform
  30. Webpack5 cache
  31. The difference between drop-down box select option and datalist
  32. CSS review (III)
  33. Node.js学习笔记【七】
  34. Node.js learning notes [VII]
  35. Vue Router根据后台数据加载不同的组件(思考-&gt;实现-&gt;不止于实现)
  36. Vue router loads different components according to background data (thinking - & gt; Implementation - & gt; (more than implementation)
  37. 【JQuery框架,Java编程教程视频下载
  38. [jQuery framework, Java programming tutorial video download
  39. Vue Router根据后台数据加载不同的组件(思考-&gt;实现-&gt;不止于实现)
  40. Vue router loads different components according to background data (thinking - & gt; Implementation - & gt; (more than implementation)
  41. 【Vue,阿里P8大佬亲自教你
  42. 【Vue基础知识总结 5,字节跳动算法工程师面试经验
  43. [Vue, Ali P8 teaches you personally
  44. [Vue basic knowledge summary 5. Interview experience of byte beating Algorithm Engineer
  45. 【问题记录】- 谷歌浏览器 Html生成PDF
  46. [problem record] - PDF generated by Google browser HTML
  47. 【问题记录】- 谷歌浏览器 Html生成PDF
  48. [problem record] - PDF generated by Google browser HTML
  49. 【JavaScript】查漏补缺 —数组中reduce()方法
  50. [JavaScript] leak checking and defect filling - reduce() method in array
  51. 【重识 HTML (3),350道Java面试真题分享
  52. 【重识 HTML (2),Java并发编程必会的多线程你竟然还不会
  53. 【重识 HTML (1),二本Java小菜鸟4面字节跳动被秒成渣渣
  54. [re recognize HTML (3) and share 350 real Java interview questions
  55. [re recognize HTML (2). Multithreading is a must for Java Concurrent Programming. How dare you not
  56. [re recognize HTML (1), two Java rookies' 4-sided bytes beat and become slag in seconds
  57. 【重识 HTML ,nginx面试题阿里
  58. 【重识 HTML (4),ELK原来这么简单
  59. [re recognize HTML, nginx interview questions]
  60. [re recognize HTML (4). Elk is so simple