Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Follow comments directions. Ignore the code after the comments are wrong. File Edit Selection View Go Run Terminal Help currency.js - Visual Studio Code X

image text in transcribedFollow comments directions. Ignore the code after the comments are wrong.

File Edit Selection View Go Run Terminal Help currency.js - Visual Studio Code X JS currency.js X ge Pohy C: > Users > Owner > test > www > js > JS currency.js > ... 1 War docurrency = function(){ 2 3 console.log("GETTING CURRENCY"); 4 var xmlhttp = new XMLHttpRequest(); 5 xmlhttp.onreadystatechange = function () { 6 if (this.readyState == 4 && this.status == 200) { 7 let currency = JSON.parse(this.responseText); 8 console.log(currency); 9 buildcurrency(currency); 10 11 }; 12 url = "https://api.exchangeratesapi.io/latest?base=USD" 13 14 xmlhttp.open("GET", url, true); 15 xmlhttp.send(); 16 } 17 function buildcurrency(currency) { let workspace = document.getElementById("content"); workspace.innerHTML = ""; //TODO : CURRENCY DATA IS IN JSON OBJECT currency //All you need to do is build it into content. 18 19 20 21 22 23 24 25 26 27 28 29 Window Snip workspace.innerHTML = "1 USD to CAD " + currency.rates.CAD; document.getElementById("content").innerHTML = "1 USD to HKD + currency.rates.HKD; document.getElementById("content").innerHTML = "1 USD to ISK " + currency.rates. ISK; document.getElementById("content").innerHTML = "1 USD to PHP + currency.rates.PHP; document.getElementById("content").innerHTML = "1 USD to DKK " + currency.rates.DKK; document.getElementById("content").innerHTML = "1 USD to HUF + currency.rates.HUF; document.getElementById("content").innerHTML = "1 USD to CZK + currency.rates.czK; document notilomantRutd/"content" innerHTML - "1 USD to GRD "I currency ratec GRD. 30 31 32 22 In 1, Col1 Spaces: 4 UTF-8 CRLF JavaScript File Edit Selection View Go Run Terminal Help currency.js - Visual Studio Code X JS currency.js X ge Pohy C: > Users > Owner > test > www > js > JS currency.js > ... 1 War docurrency = function(){ 2 3 console.log("GETTING CURRENCY"); 4 var xmlhttp = new XMLHttpRequest(); 5 xmlhttp.onreadystatechange = function () { 6 if (this.readyState == 4 && this.status == 200) { 7 let currency = JSON.parse(this.responseText); 8 console.log(currency); 9 buildcurrency(currency); 10 11 }; 12 url = "https://api.exchangeratesapi.io/latest?base=USD" 13 14 xmlhttp.open("GET", url, true); 15 xmlhttp.send(); 16 } 17 function buildcurrency(currency) { let workspace = document.getElementById("content"); workspace.innerHTML = ""; //TODO : CURRENCY DATA IS IN JSON OBJECT currency //All you need to do is build it into content. 18 19 20 21 22 23 24 25 26 27 28 29 Window Snip workspace.innerHTML = "1 USD to CAD " + currency.rates.CAD; document.getElementById("content").innerHTML = "1 USD to HKD + currency.rates.HKD; document.getElementById("content").innerHTML = "1 USD to ISK " + currency.rates. ISK; document.getElementById("content").innerHTML = "1 USD to PHP + currency.rates.PHP; document.getElementById("content").innerHTML = "1 USD to DKK " + currency.rates.DKK; document.getElementById("content").innerHTML = "1 USD to HUF + currency.rates.HUF; document.getElementById("content").innerHTML = "1 USD to CZK + currency.rates.czK; document notilomantRutd/"content" innerHTML - "1 USD to GRD "I currency ratec GRD. 30 31 32 22 In 1, Col1 Spaces: 4 UTF-8 CRLF JavaScript

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

SQL Server T-SQL Recipes

Authors: David Dye, Jason Brimhall

4th Edition

1484200616, 9781484200612

More Books

Students also viewed these Databases questions