You need to use the then
after you call the function, not inside it. I changed it to fetch so i could show you in a snippet.
const getRobotsThen = () => {
return fetch("https://jsonplaceholder.typicode.com/users");
};
getRobotsThen()
.then(res => res.json())
.then(data => console.log(data));
Another option is to use the async await combo
const getRobotsAsync = async () => {
const res = await fetch("https://jsonplaceholder.typicode.com/users");
return await res.json();
}
// await only works in an async function, thats why there is an IIFE
(async () => {
let robotsValueAsync = await getRobotsAsync();
console.log(robotsValueAsync);
})()