10000 Promise in js · anshi-the-coder/Javascript@334a59d · GitHub
[go: up one dir, main page]

Skip to content

Commit 334a59d

Browse files
Promise in js
1 parent 6798108 commit 334a59d

File tree

2 files changed

+27
-0
lines changed

2 files changed

+27
-0
lines changed

Promises/index.html

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8">
5+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
6+
<title>Document</title>
7+
</head>
8+
<body>
9+
<script src="script.js"></script>
10+
</body>
11+
</html>

Promises/script.js

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
let promise = new Promise(function(resolve,reject){
2+
alert("Hello")
3+
resolve(56)
4+
})
5+
console.log("Hello One")
6+
setTimeout(function(){
7+
console.log("Hello Two in 2 seconds")
8+
}, 2000)
9+
console.log("My name is " + "Hello Three")
10+
console.log(promise)
11+
12+
// fetch google.com homepage ==>console.log("google.com homepage done")
13+
// fetch data from the data API
14+
// fetch picture from the server
15+
// print the downloading
16+
// rest of the script

0 commit comments

Comments
 (0)
0