Consider this code:
const myPromise = new Promise((resolve, reject ) => {
setTimeout(() => {
console.log("log1!")
resolve({
name: 'whatever',
age: 17
})
}, 3000)
})
myPromise.then((data) => data.age) // breakpoint here
I want to log data
in the browser. Breakpoint stops when the promise fires but not after it resolves so cannot check the value of data
.
I tried "pretty print" icon in the browser {}
but does not break the line of the promise .then
so that I cannot add a breakpoint and check the result.
Is there any way to log data
in the browser?