😍IIFE=>Immediately Invoked Function Expression=>khởi tạo function & chạy ngay, import, export như nào

index.html

<!DOCTYPE html>
<html>
<body>
  <h1>JavaScript Modules</h1>
  <script type="module" src="app.js"></script>
</body>
</html>

file1.js

export const greet = (name) => {
  return `Hello, ${name}!`;
};

file2.js

import { greet } from './file1.js';
const aa = (function () {
  const message1 = greet('John 2');
  return {
    message1
  }
})();
export default aa;

file3.js

app.js

Last updated