# Common Interview Questions — Babel & SWC

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

> Essential Babel and SWC concepts for tech interviews.

**Quiz:** What is the primary purpose of Babel?

- [x] To convert modern JavaScript to ES5-compatible syntax for older browsers
- [ ] To minify and compress JavaScript files
- [ ] To bundle multiple files into one

*Answer:* To convert modern JavaScript to ES5-compatible syntax for older browsers. Babel transpiles modern JavaScript to compatible older syntax. Minification and bundling are separate concerns handled by other tools.

**Quiz:** Why is SWC faster than Babel?

- [ ] SWC skips transpilation of large files
- [x] SWC is written in Rust and compiled to native code, while Babel is interpreted JavaScript
- [ ] SWC doesn't transpile JSX or TypeScript

*Answer:* SWC is written in Rust and compiled to native code, while Babel is interpreted JavaScript. SWC's Rust implementation enables massive performance gains. Compiled native code is far faster than interpreted JavaScript for CPU-intensive parsing and AST transformation.

**Quiz:** Can Babel add runtime features that don't exist in the target browser?

- [ ] Yes, always
- [x] No, Babel can only transpile syntax; runtime features require polyfills
- [ ] Yes, but only for Promise and Array methods

*Answer:* No, Babel can only transpile syntax; runtime features require polyfills. Babel transpiles syntax but cannot create functions that don't exist. For runtime features like `Promise.all()` or `Array.prototype.includes()`, use polyfills like core-js.
