当前位置:网站首页>专题 | 同步 异步
专题 | 同步 异步
2022-07-03 07:18:00 【快乐的高兴的学习代码中】
1.

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title></title>
</head>
<body>
<script>
console.log(1);
console.log(2);
console.log(3);
</script>
</body>
</html>2

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title></title>
</head>
<body>
<script>
console.log(1);
setTimeout(function(){
console.log(2);
},1000)
console.log(3);
</script>
</body>
</html>3.

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title></title>
</head>
<body>
<script>
console.log(1);
setTimeout(function(){
console.log(4);
},0)
console.log(3);
</script>
</body>
</html>
4.

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title></title>
</head>
<body>
<script>
console.log(1);
setTimeout(function(){
console.log(2);
},3000)
setTimeout(function(){
console.log(3);
},1000)
</script>
</body>
</html>5.

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title></title>
</head>
<body>
<script>
console.log('1');
setTimeout(function () {
console.log('2');
new Promise(function(resolve, reject) {
console.log('promise-start2');
resolve();
}).then(function() {
console.log('promise-end2');
});
},0);
new Promise(function(resolve, reject) {
console.log('promise-start');
resolve();
}).then(function() {
console.log('promise-end');
});
setTimeout(function () {
console.log('3');
},0);
console.log('4');
</script>
</body>
</html>
还是不懂promise的目的
6.这个经典,随便换着位置理解
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title></title>
</head>
<body>
<script>
console.log('1');
new Promise(function(resolve, reject) {
console.log('promise-start2');
// setTimeout(function () {
// console.log('6');
// },0);
resolve();
}).then(function() {
setTimeout(function () {
console.log('3');
},0);
console.log('promise-end2');
});
console.log('4');
</script>
</body>
</html>边栏推荐
猜你喜欢

Pits encountered in the use of El checkbox group

Common APIs

Common problems in io streams

Notes on the core knowledge of Domain Driven Design DDD

How to specify the execution order for multiple global exception handling classes
![PdfWriter. GetInstance throws system Nullreferenceexception [en] pdfwriter GetInstance throws System. NullRef](/img/65/1f28071fc15e76abb37f1b128e1d90.jpg)
PdfWriter. GetInstance throws system Nullreferenceexception [en] pdfwriter GetInstance throws System. NullRef

高并发内存池

Sorting out the core ideas of the pyramid principle

Wireshark software usage

Recursion, Fibonacci sequence
随机推荐
Flask Foundation
The underlying mechanism of advertising on websites
Advanced API (local simulation download file)
2021 year end summary
Specified interval inversion in the linked list
C WinForm framework
[set theory] partition (partition | partition example | partition and equivalence relationship)
Practice of enterprise ab/testing platform
MySQL syntax (basic)
在 4EVERLAND 上存储 WordPress 媒体内容,完成去中心化存储
Selenium key knowledge explanation
php安装composer
TCP cumulative acknowledgement and window value update
Inno setup production and installation package
Setting up the development environment of dataworks custom function
Download address collection of various versions of devaexpress
JMeter JSON extractor extracts two parameters at the same time
Summary of abnormal mechanism of interview
万卷书 - 价值投资者指南 [The Education of a Value Investor]
【已解决】Unknown error 1146