当前位置:网站首页>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>边栏推荐
- PdfWriter. GetInstance throws system Nullreferenceexception [en] pdfwriter GetInstance throws System. NullRef
- Book recommendation~
- Advanced API (batch image Download & socket dialog)
- Win 10 find the port and close the port
- JMeter test result output
- Interview questions about producers and consumers (important)
- Summary of abnormal mechanism of interview
- JUC forkjoinpool branch merge framework - work theft
- 在 4EVERLAND 上存储 WordPress 媒体内容,完成去中心化存储
- Laravel框架 踩坑(一)
猜你喜欢

Sorting, dichotomy

3311. 最长算术
![[solved] sqlexception: invalid value for getint() - 'Tian Peng‘](/img/bf/f6310304d58d964b3d09a9d011ddb5.png)
[solved] sqlexception: invalid value for getint() - 'Tian Peng‘

Arctic code vault contributor

JUC forkjoinpool branch merge framework - work theft

691. 立方体IV

Store WordPress media content on 4everland to complete decentralized storage

Specified interval inversion in the linked list

Basic knowledge about SQL database

dataworks自定义函数开发环境搭建
随机推荐
IP home online query platform
When MySQL inserts Chinese into the database, there is a diamond question mark garbled code
Notes on the core knowledge of Domain Driven Design DDD
Laravel Web框架
4EVERLAND:IPFS 上的 Web3 开发者中心,部署了超过 30,000 个 Dapp!
Book recommendation~
2021 year end summary
萬卷書 - 價值投資者指南 [The Education of a Value Investor]
【已解决】Unknown error 1146
Advanced API (local simulation download file)
2021-07-18
twenty million two hundred and twenty thousand three hundred and nineteen
Resthighlevelclient gets the mapping of an index
Upgrade CentOS php7.2.24 to php7.3
3311. 最长算术
File links cannot be opened or downloaded in Google browser
dataworks自定義函數開發環境搭建
dataworks自定义函数开发环境搭建
MySQL syntax (basic)
10 000 volumes - Guide de l'investisseur en valeur [l'éducation d'un investisseur en valeur]