async/await vs Promises in JavaScript

JavaScript Interview Question: What is the difference between async/await and Promises? Answer: async/await is syntax built on top of Promises that allows writing asynchronous code in a synchronous style. Example: 𝘤𝘰𝘯𝘴𝘵 𝘥𝘢𝘵𝘢 = 𝘢𝘸𝘢𝘪𝘵 𝘧𝘦𝘵𝘤𝘩("/𝘢𝘱𝘪") Explanation: async/await improves readability and reduces nested .then() chains. Follow-up Interview Question: Does async/await remove Promises internally? Answer: No. Explanation: async/await still uses Promises under the hood. #javascript #AsyncProgramming #WebDevelopment #SoftwareEngineering

To view or add a comment, sign in

Explore content categories