We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 1bd7dab commit 33b262eCopy full SHA for 33b262e
hw2.js
@@ -0,0 +1,32 @@
1
+const posts = [
2
+ { postName: 'Post1 ', author: 'yazar 1' },
3
+ { postName: 'post 2 ', author: 'yazar 2' },
4
+ { postName: 'post 3 ', author: 'yazar 3' },
5
+
6
+]
7
8
+const listPosts = () => {
9
+ posts.map(post => {
10
+ console.log(post.postName)
11
+ })
12
+}
13
14
+const addPosts = (newpost) => {
15
+ const promise = new Promise((resolve, reject) => {
16
+ posts.push(newpost);
17
+ resolve(posts);
18
+ reject('bir hata olustu');
19
20
+ return promise;
21
22
23
+async function showPosts (){
24
+ try{
25
+ await addPosts({ postName: 'Post 5 ', author: 'yazar 5' })
26
+ listPosts();
27
+ }
28
+ catch(error){
29
+ console.log(error);
30
31
32
+showPosts();
0 commit comments