News for hackers. Stuff that matters.
Re:Show HN: Free API service for crypto and foreign exchange... by de6u99er on Wednesday July 22, 2020 @04:53PM (#23921445)
Thanks for sharing, that's really useful. I realized you did the javascript example using XHR Any reason why you didn't use fetch?

``` fetch(url) .then((resp) => resp.json()) .then((data) => { console.log(data) }) ```

instead of

``` var requestURL = 'https://api.exchangerate.host/latest'; var request = new XMLHttpRequest(); request.open('GET', requestURL); request.responseType = 'json';

request.send(); request.onload = function() { var response = request.response; console.log(response); } ```

Re:Show HN: Free API service for crypto and foreign exchange... by aaomidi on Wednesday July 22, 2020 @10:59PM (#23923771)
fetch isn't universally supported.