250x250
Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | ||||||
2 | 3 | 4 | 5 | 6 | 7 | 8 |
9 | 10 | 11 | 12 | 13 | 14 | 15 |
16 | 17 | 18 | 19 | 20 | 21 | 22 |
23 | 24 | 25 | 26 | 27 | 28 |
Tags
- CLASS
- 삶
- Props
- middleware
- error
- HTML
- typeScript
- CSS
- Ethereum
- nextJS
- Interface
- evm
- 기준
- Redux
- blockchain
- REACT
- solidity
- useState
- JavaScript
- SSR
- graphQL
- tailwindcss
- API
- web
- express.js
- bitcoin
- hardhat
- node.js
- built in object
- concept
Archives
- Today
- Total
ReasonJun
javascript : module 본문
728x90
// key.js
export const birthKey = Symbol('Date of birth');
export const emailKey = Symbol('Emails');
// youjun.js
import { birthKey, emailKey } from './key';
export default {
firstName: 'youjun',
lastName: 'park',
age: 22,
[birthKey]: new Date(1985, 11, 16, 17, 30),
[emailKey]: ['thiehis@gmail.com'],
};
// main.js
import youjun from './youjun.js';
import { birthKey, emailKey } from './key.js';
console.log(youjun);
console.log(Object.keys(youjun)); // ['firstName', 'lastName', 'age']
console.log(youjun[birthKey]);
console.log(youjun[emailKey]);
import { increase as increase1 } from './counter.js';
import { increase, getCount } from './counter.js';
import * as counter from './counter.js'; // This way you can import them as a group.
import increase from './counter.js';
counter.increase();
counter.increase();
counter.increase();
console.log(counter.getCount());
728x90
'Frontend > Javasciprt' 카테고리의 다른 글
javascript : Scope, Garbage Collection (0) | 2023.06.07 |
---|---|
javascript : Async (0) | 2023.06.07 |
Javascript : Operators Basic (0) | 2023.06.07 |
javascript : spread / destructing assignment (0) | 2023.06.07 |
Javascript : Loop (1) | 2023.06.07 |
Comments