🧩 1. ES6 Module Pattern (using export / import) 📁 mathUtils.js export const add = (a, b) => a + b; export const multiply = (a, b) => a * b; 📁 main.js import { add, multiply } from './mathUtils.js'; console.log(add(2, 3)); // 5 console.log(multiply(2, 3)); // 6 🧱 2. CommonJS Module Pattern (Node.js style) 📁 mathUtils.js function add(a, b) { return a + b; } function multiply(a, b) { return a * b; } module.exports = { add, multiply }; 📁 main.js const { add, multiply } = require('./mathUtils'); console.log(add(4, 5)); // 9 console.log(multiply(4, 5)); // 20