I have this one line of code but I cant seem to understand how this works
let p1 = p.then(a => [p1])
let [p2] = await p1
console.log(p1===p2)
I cant understand the first line. how can then
get a hold of p1
. afaik, a => [p1]
inside then
is executed immediately, but at the time of execution ,surely p1
was not formed yet. so, how come that code work? not only that, it somehow manages to correctly refer to itself. can anybody help understand what’s going on here?
thanks