For this exercise, we will use data from the AlphaVantage API.
Specifically we will use the "Company Overview" endpoint
to fetch financial information about a given company.
Consult the API documentation to learn more.
Setup
First obtain an AlphaVantage API Key, and supply it when prompted.
Part 1
Write JavaScript code to answer the questions below.
Log each of the answers to the console.
Define a function called lookupCompany. It should:
Identify the stock symbol that has been input into the provided input element, and store it in a variable called symbol.
Dynamically compile a request URL for the specified company, and store it in a variable called requestUrl.
Fetch information about the specified company using the specified request URL.
Display information about the company, including its:
name (i.e. "Netflix Inc"), description, and website URL.
Invoke the function once when the page initially loads (no need for an event listener).
Add an event listener to also invoke the function whenever the "Lookup" button is clicked.
Part 2
Write JavaScript code to answer the questions below.
Display the answers on the page in the designated areas.
Revisit the lookupCompany function from Part 1. It should also:
Display the company's name in the provided span element.
Display the company's description in the provided span element.
Display a hyperlink to the company's website in the provided a element. The link's text and href attribute should both be the website URL.