当前位置:网站首页>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>边栏推荐
- 【已解决】SQLException: Invalid value for getInt() - ‘田鹏‘
- Specified interval inversion in the linked list
- Deep learning parameter initialization (I) Xavier initialization with code
- PHP install the spool extension
- Visit Google homepage to display this page, which cannot be displayed
- In depth analysis of reentrantlock fair lock and unfair lock source code implementation
- sharepoint 2007 versions
- 2021-07-18
- I. D3.js hello world
- docker建立mysql:5.7版本指定路径挂载不上。
猜你喜欢

Reading notes of "learn to ask questions"

On the practice of performance optimization and stability guarantee

Dora (discover offer request recognition) process of obtaining IP address

PAT甲级真题1166
![[solved] unknown error 1146](/img/f1/b8dd3ca8359ac9eb19e1911bd3790a.png)
[solved] unknown error 1146

带你全流程,全方位的了解属于测试的软件事故

SecureCRT取消Session记录的密码

1. E-commerce tool cefsharp autojs MySQL Alibaba cloud react C RPA automated script, open source log

Practice of enterprise ab/testing platform

高并发内存池
随机推荐
Chrome 98 Private Network Access problem w/ disabled web security: Request had no target IP address
树莓派更新工具链
Win 10 find the port and close the port
Download address collection of various versions of devaexpress
docker建立mysql:5.7版本指定路径挂载不上。
【CMake】CMake链接SQLite库
centos php7.3安装redis扩展
[solved] unknown error 1146
Jeecg data button permission settings
JS date comparison
Advanced API (character stream & net for beginners)
crontab定时任务
SharePoint modification usage analysis report is more than 30 days
2021-07-18
Dora (discover offer request recognition) process of obtaining IP address
Visit Google homepage to display this page, which cannot be displayed
在 4EVERLAND 上存储 WordPress 媒体内容,完成去中心化存储
[Fiddler actual operation] how to use Fiddler to capture packets on Apple Mobile Phones
High concurrency memory pool
How can I split a string at the first occurrence of “-” (minus sign) into two $vars with PHP?