홍승아블로그

javascript

// 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 참고사이트
이전글
canvas
다음글
redux-toolkit