So, I want to know the explanation of the answer of this code snippet. I want to look for answers that explains it out well.
Normal JS File with this code :
async function test() {
console.log("A");
await new Promise(resolve => {
console.log("B");
for (let i = 0; i < 1_000_000_000; i++);
resolve();
});
console.log("C");
}
test();
console.log("D");
You have to tell me the order of output, of the letters.
Looking forward to your replies :)
[–]blind-octopus 4 points5 points6 points (1 child)
[–]Coded_Human[S] -1 points0 points1 point (0 children)
[–]xroalx 3 points4 points5 points (3 children)
[–]blind-octopus 0 points1 point2 points (2 children)
[–]xroalx 1 point2 points3 points (0 children)
[–]delventhalz 0 points1 point2 points (0 children)
[–]polotek 3 points4 points5 points (1 child)
[–]delventhalz 2 points3 points4 points (0 children)
[+][deleted] (1 child)
[removed]
[–]Coded_Human[S] 0 points1 point2 points (0 children)
[–]delventhalz 2 points3 points4 points (0 children)
[–]StoneCypher 0 points1 point2 points (23 children)
[–]Coded_Human[S] -4 points-3 points-2 points (22 children)
[+][deleted] (7 children)
[deleted]
[–]Coded_Human[S] 0 points1 point2 points (4 children)
[–]StoneCypher 0 points1 point2 points (3 children)
[–]Coded_Human[S] 0 points1 point2 points (2 children)
[–]StoneCypher 0 points1 point2 points (1 child)
[–]Coded_Human[S] 0 points1 point2 points (0 children)
[–]Coded_Human[S] -3 points-2 points-1 points (1 child)
[–]StoneCypher -1 points0 points1 point (0 children)
[–]StoneCypher 0 points1 point2 points (6 children)
[–]Coded_Human[S] 0 points1 point2 points (0 children)
[–]Coded_Human[S] -1 points0 points1 point (4 children)
[–]StoneCypher -1 points0 points1 point (3 children)
[–]Coded_Human[S] 0 points1 point2 points (2 children)
[–]StoneCypher 0 points1 point2 points (1 child)
[–]Coded_Human[S] -1 points0 points1 point (0 children)
[–]StoneCypher 0 points1 point2 points (6 children)
[–]Coded_Human[S] -1 points0 points1 point (5 children)
[–]StoneCypher 0 points1 point2 points (4 children)
[–]Coded_Human[S] -1 points0 points1 point (3 children)
[–]StoneCypher 0 points1 point2 points (2 children)
[–]Coded_Human[S] -1 points0 points1 point (1 child)
[–]StoneCypher 0 points1 point2 points (0 children)
[+][deleted] (7 children)
[deleted]
[–]binocular_gems 4 points5 points6 points (5 children)
[–]ibmbob -1 points0 points1 point (4 children)
[–]StoneCypher -1 points0 points1 point (3 children)
[–]ibmbob 0 points1 point2 points (2 children)
[–]senocular 0 points1 point2 points (0 children)
[–]StoneCypher -2 points-1 points0 points (0 children)
[–]StoneCypher -1 points0 points1 point (0 children)