// app.js
let users = ['hong', 'kim', 'choi'];
export const addUsers = user => (users = [...users, user]);
export const getUsers = () => users;
export const deleteUsers = user =>
(users = users.filter(aUser => aUser !== user));
//app2.js
import { addUsers, getUsers } from './app.js';
console.log(getUsers());
addUsers('seyoung');
console.log(getUsers());
- Javascript6~10 참고사이트