What is the output of the following? “`js let resolve; const p = new Promise(r => { resolve = r; }); p.then(v => console.log(‘resolved:’, v)); resolve(42); console.log(‘sync done’); “`
The correct answer is "sync done, resolved: 42" because the Promise is resolved with the value 42 before the "sync done" message is logged. This demonstrates the asynchronous nature of Promises in JavaScript.
LinkedIn does not guarantee automatic field prefilling across all devices. Use the verified credential details below to complete your LinkedIn profile certification entry.