File tree Expand file tree Collapse file tree 4 files changed +9
-1
lines changed
Expand file tree Collapse file tree 4 files changed +9
-1
lines changed Original file line number Diff line number Diff line change 88 const xhr = new XMLHttpRequest ( ) ;
99 xhr . open (
1010 'GET' ,
11- `http://api.nobelprize.org/v1/laureate.json?bornCountryCode=TR` ,
11+ `http://api.nobelprize.org/v1/laureate.json?bornCountryCode=TR`
1212 ) ;
1313 xhr . onload = ( ) => {
1414 console . log ( xhr . response ) ;
15+ console . log ( typeof xhr . response ) ;
16+
17+ const result = JSON . parse ( xhr . response ) ;
18+ console . log ( result ) ;
19+ console . log ( typeof result ) ;
1520 } ;
1621 xhr . send ( ) ;
1722}
Original file line number Diff line number Diff line change 1919
2020 fetchData ( url , data => {
2121 console . log ( data ) ;
22+ console . log ( typeof data ) ;
2223 } ) ;
2324}
Original file line number Diff line number Diff line change 2121
2222 fetchJSON ( url , data => {
2323 console . log ( data ) ;
24+ console . log ( typeof data ) ;
2425 } ) ;
2526}
Original file line number Diff line number Diff line change 44 Handle:
55 1. HTTP errors
66 2. Network errors
7+ Create an Error object to report errors
78*/
89
910'use strict' ;
You can’t perform that action at this time.
0 commit comments