반응형
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// template-tag.js | |
let count = 10; | |
let price = 0.25; | |
let message = passthru`${count} items cost $${(count * price).toFixed(2)}.`; | |
function passthru(literals, ...substitutions) { | |
console.log(literals); // [ '', ' items cost $', '.' ] | |
console.log(substitutions); // [ 10, '2.50' ] | |
} | |
728x90
반응형
'Javascript' 카테고리의 다른 글
Error first callback (0) | 2018.11.22 |
---|---|
String.raw (0) | 2018.11.22 |
치환자 ${} (0) | 2018.11.22 |
JSFiddle 에서 console 사용하기 (0) | 2018.11.22 |
TDZ (0) | 2018.11.22 |