I am in the process of developing a Promise with the objective of adding up any numbers discovered within an array or JSON object.
The add() function is designed to receive a series of URLs as a string input and calculate the total sum of those URLs.
Here's my approach:
I've introduced a helper function named parse, which accepts a string (the URL) and should display the JSON object specified at that location.
My issue arises when looking at the section marked by $$$$, where the jsonObject
correctly represents the parsed JSON object. However, moving on to the area indicated by **** right after calling parse, the parsedObj
no longer reflects the accurately parsed JSON object.
For instance, if I try to parse a JSON object that includes [1, 2, 5, 4]
, I'll receive jsonObject = 1,2,5,4
while parsedObj = [object Promise]
.
Why does parsedObj
show an array of [object Promise] instead of 1,2,5,4
?