코딩쌀롱

2021.3.3(wed)_TIL(ES Modules, 배열에 비동기, slice, substring) 본문

회고/하루 기록

2021.3.3(wed)_TIL(ES Modules, 배열에 비동기, slice, substring)

이브✱ 2021. 3. 4. 00:31

✱ES Modules

export default 할 때는 넘기는 게 딱 하나일 때

export default ref;

import ref from './ref.js'

 

넘기는 게 여러 개 라면 export { ~, ~, ...}

export { a, b, c } 

import { a, b, c } from './ref.js'

 

넘기는 게 여러 개이고, 받을 때 한 변수에 담아서 받고 싶다면

export { a, b, c, d, e, f }

import * as elements from './ref.js'

 

✱ 배열에 비동기 작업 처리

배열을 가지고 〔원소1 처리 - (1초 뒤에) - 원소2 처리 - (1초 뒤에) - 원소3 처리 .... 〕이렇게 해보려는데 방법을 모르겠어서 구글링을 했다. forEach는 순차처리가 안 되고, for, for of로만 가능하다고 한다. 

블로그 글 링크!

 

✱ slice vs substring

String.prototype.slice()
str.slice(start[, end])

String.prototype.substring()
str.substring(start[, end])

블로그 글 링크!

 

위 두 내용을 직접 정리해봐야겠다. 일단 오늘은 쉬자

 

'회고 > 하루 기록' 카테고리의 다른 글

2021.3.17(wed)_express의 use, get  (2) 2021.03.18
2021.3.4(thu)_pipe 화살표함수로  (0) 2021.03.04
2021.2.26(thu)_translate  (2) 2021.02.26
2021.2.23(tue)_express 싸우자🤬  (2) 2021.02.23
Comments