I'm trying to create a calculator in JavaScript. In this calculator I have a button to convert the number inputed by user to dollars. I have an api with a key but somehow I can't make it to display the result on the calculator.
case 'convert':
let eur = parseFloat(num)
console.log(eur)
const url = 'https://v6.exchangerate-api.com/v6/my-api-key/pair/EUR/USD/' + eur
fetch(url)
.then(response => response.json())
let converted = JSON.parse(response.json())
display.value = converted
num = 0
break