Recently I wanted to write a crawler novel to read, but I encountered some difficulties
console.log(catalogUrl) can print out the required URL
But what I expect is that when I call the function var xxx = getCatalogUrl(book) externally, I can get the value of the catalogUrl variable.
I tried return and global variables, but none of them work.
Help all the experts!
You need to understand js callback promise async/await
catalogUrl is in the asynchronous function! How to solve the asynchronous problem, look at these materials or Baidu, they are all basic things