Sollicitatievraag bij Accenture

Difference between require and import?

Antwoorden op sollicitatievragen

Anoniem

15 aug 2021

You can't selectively load only the pieces you need with require but with imports, you can selectively load only the pieces you need. That can save memory. Loading is synchronous(step by step) for require on the other hand import can be asynchronous(without waiting for previous import) so it can perform a little better than require.

Anoniem

3 jan 2020

await is a new operator used to wait for a promise to resolve or reject. It can only be used inside an async function. Promise. all returns an array with the resolved values once all the passed-in promises have resolved