No 'Access-Control-Allow-Origin' header is present on the requested resource. error

I am getting the cors err whenver I try to fetch an api.

When I select a currency unit, I am expected to get the currency value for that exchange unit.Instead , I get this:

Here is also the link to my code :

You can use a CORS proxy
https://cors-anywhere.herokuapp.com

BTW, the no API key endpoint do have endpoints for selected currency and it just defaults to USD. The latest endpoint give you back JSON with a rate property.
https://api.exchangerate-api.com/v6/latest

Here is the docs for the standard requests using a key (they have a free version as well). This endpoint might also have the CORS header (maybe).
https://www.exchangerate-api.com/docs/standard-requests

https://prime.exchangerate-api.com/v5/YOUR-API-KEY/latest/USD