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 | 29 | 30 | 31 |
Tags
- Props
- SSR
- blockchain
- tailwindcss
- typeScript
- 삶
- hardhat
- JavaScript
- solidity
- HTML
- concept
- Redux
- evm
- express.js
- API
- useState
- nextJS
- REACT
- web
- Interface
- node.js
- CLASS
- Ethereum
- built in object
- bitcoin
- error
- middleware
- CSS
- 기준
- graphQL
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