placeholder
уже ответил. const parseGovbank = () => fetch('https://bank.gov.ua/NBUStatService/v1/statdirectory/exchange?json', { mode: 'cors' }).then(res => res.json());
const updateGovbank = () => parseGovbank()
.then(response => {
const data = [];
const findUsd = response.find(cur => cur.cc === 'USD');
data.push(findUsd);
return data[0];
})
.catch(error => console.error(error));
.catch
можно сделать обработку ошибки, не просто вывод в консоль. <table>
<thead>
<tr>
<th>ID</th>
<th>Firstname</th>
<th>Lastname</th>
<th>Age</th>
</tr>
</thead>
<tbody>
<tr>
<td>1</td>
<td>John</td>
<td>Doe</td>
<td>30</td>
</tr>
<tr>
<td>2</td>
<td>Emily</td>
<td>Watson</td>
<td>27</td>
</tr>
<tr>
<td>3</td>
<td>Jake</td>
<td>Low</td>
<td>25</td>
</tr>
<tr>
<td>4</td>
<td>Alice</td>
<td>Green</td>
<td>28</td>
</tr>
</tbody>
</table>
[
{ "id": 1, "fitrstname": "John", "lastname": "Doe", "age": 30 },
{ "id": 2, "fitrstname": "Emily", "lastname": "Watson", "age": 27 },
{ "id": 3, "fitrstname": "Jake", "lastname": "Low", "age": 25 },
{ "id": 4, "fitrstname": "Alice", "lastname": "Green", "age": 28 }
]
ID,Firstname,Lastname,Age
1,John,Doe,30
2,Emily,Watson,27
3,Jake,Low,25
4,Alice,Green,28