Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Template Literals #40

Closed
raycon opened this issue Dec 28, 2020 · 0 comments
Closed

Template Literals #40

raycon opened this issue Dec 28, 2020 · 0 comments

Comments

@raycon
Copy link
Owner

raycon commented Dec 28, 2020

Template Literals

템플릿 리터럴은 내장된 표현식을 허용하는 문자열 리터럴을 의미한다.

문법:

`string text`

`string text line 1
 string text line 2`

`string text ${expression} string text`

tag`string text ${expression} string text`

여러줄:

console.log(`string text line 1
string text line 2`);
// "string text line 1
// string text line 2"

표현식 삽입:

var a = 5;
var b = 10;
console.log(`Fifteen is ${a + b} and
not ${2 * a + b}.`);
// "Fifteen is 15 and
// not 20."

중첩:

const classes = `header ${ isLargeScreen() ? '' :
 `icon-${item.isCollapsed ? 'expander' : 'collapser'}` }`;

Tagged Tamplages 참고

@raycon raycon added the JS label Dec 28, 2020
@raycon raycon added this to the JavaScript Concepts milestone Dec 28, 2020
@raycon raycon closed this as completed Dec 29, 2020
@raycon raycon reopened this Dec 30, 2020
@raycon raycon added the done label Dec 30, 2020
@raycon raycon closed this as completed Dec 30, 2020
@raycon raycon removed the done label Dec 30, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant