Untitled

mail@pastecode.io avatar
unknown
plain_text
2 years ago
947 B
1
Indexable
Never
    async function getUrl() {
        const url = "https://financialmodelingprep.com/api/v3/nasdaq_constituent?apikey=35bc7fd74ee10e088e02607913e574bb";
        try {
            let res = await fetch(url);
            let data = await res.json();
            
            for (let i = 0; i < data.length; i++) {
                alert(data[i].symbol);
                alert(data[i].name);
                alert(data[i].sector);
                alert(data[i].founded);
            }

            return null;

            })
        }
        catch (error) {
            alert(error);
        }

    }


//other tried stuff:
            return Object.values(data).map((marketData, i) => {
                return {
                    symbol: marketData.symbol,
                    name: marketData.name,
                    sector: marketData.sector,
                    founded: marketData.founded,
                }