var incrementor = 0;
var text = "";
while( incrementor < 10 ){
text += `The incrementor has gone up to ${incrementor} \n`;
incrementor++;
}
console.log(text);
The incrementor has gone up to 0
The incrementor has gone up to 1
The incrementor has gone up to 2
The incrementor has gone up to 3
The incrementor has gone up to 4
The incrementor has gone up to 5
The incrementor has gone up to 6
The incrementor has gone up to 7
The incrementor has gone up to 8
The incrementor has gone up to 9
작은 따옴표가 아니라 backtick 문자를 눌러야 함
MacBook Air 키보드에선 숫자 1옆에 ~ 키보드 누르면 됨
backtick(`)문자와 javascript 템플릿 리터럴
키보드에는 작은따옴표와 비슷한 문자가 하나 더 있다. ` 바로 이 문자이다. javascript에서는 템플릿 리터럴에 활용되고, 마크다운에서 코드를 강조(code, fenced code block)하는데 쓰이기도 하는 문자
flik.tistory.com
'Programming > JavaScript' 카테고리의 다른 글
Event.preventDefault() (0) | 2022.03.11 |
---|---|
Sequence selection loop (0) | 2022.03.09 |
Difference Between == and === in JavaScript (0) | 2022.03.08 |
JavaScript treats variables that are undefined as false. (0) | 2022.03.08 |
Arrays (0) | 2022.03.08 |