Explain the difference between require and import.

require is used in CommonJS module syntax, prevalent in Node.js, while import is part of ES6 module syntax, which is now supported in Node.js with ES modules. For example:

// CommonJS
const moduleA = require('./moduleA');
// ES6
import moduleA from './moduleA.js';
The key difference lies in how they load modules, with `import` allowing for static analysis and tree shaking.