File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -51,3 +51,36 @@ const promiseFour = new Promise(function(resolve, reject){
5151} ) . catch ( function ( error ) {
5252 console . log ( error ) ;
5353} ) . finally ( ( ) => console . log ( "The promise is either resolved or rejected" ) )
54+
55+ async function consumePromiseFive ( ) {
56+ try {
57+ const response = await promiseFive
58+ console . log ( response ) ;
59+ } catch ( error ) {
60+ console . log ( error ) ;
61+ }
62+ }
63+
64+ consumePromiseFive ( )
65+
66+ // async function getAllUsers(){
67+ // try {
68+ // const response = await fetch('https://jsonplaceholder.typicode.com/users')
69+
70+ // const data = await response.json()
71+ // console.log(data);
72+ // } catch (error) {
73+ // console.log("E: ", error);
74+ // }
75+ // }
76+
77+ //getAllUsers()
78+
79+ fetch ( 'https://api.github.com/users/hiteshchoudhary' )
80+ . then ( ( response ) => {
81+ return response . json ( )
82+ } )
83+ . then ( ( data ) => {
84+ console . log ( data ) ;
85+ } )
86+ . catch ( ( error ) => console . log ( error ) )
You can’t perform that action at this time.
0 commit comments