Skip to content

Instantly share code, notes, and snippets.

@hagi4u
Last active January 13, 2020 07:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hagi4u/9b50717d0988f7d52a375251b26daf8f to your computer and use it in GitHub Desktop.
Save hagi4u/9b50717d0988f7d52a375251b26daf8f to your computer and use it in GitHub Desktop.
/*
* [A,B,C,D] 배열이 있을 때
* 'A, B, C and D' 형태로 영어에서 여러가지 문자들을 나열할 때 필요한
* 아웃풋을 내 주는 헬퍼
*/
export function getEnglishListUpString(x) {
return x.join(', ').replace(/, ([^, ]*)$/, ' and $1');
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment