当前位置:网站首页>Topic | synchronous asynchronous
Topic | synchronous asynchronous
2022-07-03 07:19:00 【Happy happy learning code】
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>
Still don't understand promise Purpose
6. This classic , Change position casually, understand
<!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>边栏推荐
- [solved] unknown error 1146
- MySQL syntax (basic)
- Visit Google homepage to display this page, which cannot be displayed
- 2021 year end summary
- Hash table, generic
- [vscode - vehicle plug-in reports an error] cannot find module 'xxx' or its corresponding type declarations Vetur(2307)
- How to specify the execution order for multiple global exception handling classes
- SharePoint modification usage analysis report is more than 30 days
- LeetCode
- Advanced API (serialization & deserialization)
猜你喜欢

Basic components and intermediate components

Selenium key knowledge explanation
![[Fiddler actual operation] how to use Fiddler to capture packets on Apple Mobile Phones](/img/d0/850e095a43610366d6144b2471f3f7.jpg)
[Fiddler actual operation] how to use Fiddler to capture packets on Apple Mobile Phones

【已解决】Unknown error 1146
![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

C代码生产YUV420 planar格式文件

Inno setup production and installation package

SecureCRT password to cancel session recording

Mise en place d'un environnement de développement de fonctions personnalisées

Basic knowledge about SQL database
随机推荐
crontab定时任务
[day15] introduce the features, advantages and disadvantages of promise, and how to implement it internally. Implement promise by hand
Common APIs
Interfaces and related concepts
Win 10 find the port and close the port
Mise en place d'un environnement de développement de fonctions personnalisées
docker建立mysql:5.7版本指定路径挂载不上。
Common problems in io streams
LeetCode
[HCAI] learning summary OSI model
[solved] sqlexception: invalid value for getint() - 'Tian Peng‘
php artisan
[untitled]
Use the jvisualvm tool ----- tocmat to start JMX monitoring
My 2020 summary "don't love the past, indulge in moving forward"
C code production YUV420 planar format file
Book recommendation~
【已解决】Unknown error 1146
How to specify the execution order for multiple global exception handling classes
Arctic code vault contributor