Skip to content Skip to sidebar Skip to footer

Javascript Promise Return Value

I am trying to make a crawler, and as the data is not showing in the page source, I can only execute the javascript with the web driver and get the response, and then do the data a

Solution 1:

When you try to log the global res, the result hasn't been computed yet. When using Promises, you have to get the result asynchronously, using .then, like this:

f1().then(res => console.log("result =", res));

Solution 2:


Post a Comment for "Javascript Promise Return Value"