Answer the question
In order to leave comments, you need to log in
Why is undefined returned?
Qty:
const { AnimeWallpaper } = require("anime-wallpapers");
const wall = new AnimeWallpaper();
function wallpaper3() {
const wallpaper = wall.getAnimeWall3()
gif_url = JSON.parse(wallpaper);
console.log(gif_url.image[1])
}
wallpaper3()
Auto installing libraries...
Auto installation complete.
+ node index.js
undefined:1
[object Promise]
^
SyntaxError: Unexpected token o in JSON at position 1
at JSON.parse (<anonymous>)
at wallpaper3 (/home/dcoder/anime/index.js:6:20)
at Object.<anonymous> (/home/dcoder/anime/index.js:12:1)
at Module._compile (internal/modules/cjs/loader.js:1137:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1157:10)
at Module.load (internal/modules/cjs/loader.js:985:32)
at Function.Module._load (internal/modules/cjs/loader.js:878:14)
at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:71:12)
at internal/main/run_main_module.js:17:47
Answer the question
In order to leave comments, you need to log in
Read the documentation. Here, in theory, an asynchronous call
const wallpaper =
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question