# Common Interview Questions — बेबल और SWC

Source: https://www.geekswithgeeks.com/hi/babel-swc/bs-interview-questions

> Tech interviews के लिए essential Babel और SWC concepts।

**Quiz:** Babel का प्राथमिक उद्देश्य क्या है?

- [x] पुराने browsers के लिए आधुनिक JavaScript को ES5-compatible syntax में convert करना
- [ ] JavaScript फ़ाइलों को minify और compress करना
- [ ] Multiple फ़ाइलों को एक में bundle करना

*Answer:* पुराने browsers के लिए आधुनिक JavaScript को ES5-compatible syntax में convert करना. Babel आधुनिक JavaScript को compatible पुरानी syntax में transpile करता है। Minification और bundling अलग concerns हैं जो अन्य tools द्वारा संभाले जाते हैं।

**Quiz:** SWC Babel से तेज क्यों है?

- [ ] SWC बड़ी फ़ाइलों के transpilation को skip करता है
- [x] SWC को Rust में लिखा गया है और native code में compiled है, जबकि Babel interpreted JavaScript है
- [ ] SWC JSX या TypeScript को transpile नहीं करता

*Answer:* SWC को Rust में लिखा गया है और native code में compiled है, जबकि Babel interpreted JavaScript है. SWC का Rust implementation बहुत बड़े performance gains को enable करता है। Compiled native code CPU-intensive parsing और AST transformation के लिए interpreted JavaScript से बहुत तेज है।

**Quiz:** क्या Babel runtime features को add कर सकता है जो target browser में exist नहीं करते?

- [ ] हाँ, हमेशा
- [x] नहीं, Babel केवल syntax को transpile कर सकता है; runtime features को polyfills की जरूरत है
- [ ] हाँ, लेकिन केवल Promise और Array methods के लिए

*Answer:* नहीं, Babel केवल syntax को transpile कर सकता है; runtime features को polyfills की जरूरत है. Babel syntax को transpile करता है लेकिन functions को नहीं बना सकता जो exist नहीं करते। `Promise.all()` या `Array.prototype.includes()` जैसी runtime features के लिए, core-js जैसे polyfills का उपयोग करें।
