click here for the imageI am currently utilizing the quotes API in order to retrieve and display quotes. While I am able to print the entire object containing all information about the quote, I am encountering an issue where I cannot access the specific values within it - resulting in 'undefined' being logged in the console.
My expectation was to successfully extract individual values from objects when calling them, such as result.content. Below is the provided code snippet:
const url = "https://quotes15.p.rapidapi.com/quotes/random/";
const options = {
method: "GET",
headers: {
"X-RapidAPI-Key": "api_key",
"X-RapidAPI-Host": "quotes15.p.rapidapi.com",
},
};
(async function main() {
// You can use await inside this function block
try {
const response = await fetch(url, options);
const result = await response.text();
console.log(result);
console.log(result.name);
} catch (error) {
console.error(error);
}
})();