😍IIFE=>Immediately Invoked Function Expression=>khởi tạo function & chạy ngay, import, export như nào
<!DOCTYPE html>
<html>
<body>
<h1>JavaScript Modules</h1>
<script type="module" src="app.js"></script>
</body>
</html>export const greet = (name) => {
return `Hello, ${name}!`;
};
import { greet } from './file1.js';
const aa = (function () {
const message1 = greet('John 2');
return {
message1
}
})();
export default aa;
Previous[JavaScript chuyên sâu]: Từ hàm IIFE tới Module PatternNextTìm hiểu về Higher-Order Functions trong JavaScript
Last updated