The code compiled with typescript is as follows:
function test(template, name, age) {
console.log(template);
console.log(name);
console.log(age);
}
let myname: string = "Keyon";
let myage: number = 18;
test`Hello, my name is ${myname}, I'm ${myage}.`;
function test(template, name, age) {
console.log(template);
console.log(name);
console.log(age);
}
var myname = "Keyon";
var myage = 18;
(_a = ["Hello, my name is ", ", I'm ", "."], _a.raw = ["Hello, my name is ", ", I'm ", "."], test(_a, myname, myage));
var _a;
(_a = ["Hello, my name is ", ", I'm ", "."], _a.raw = ["Hello, my name is ", ", I'm ", "." ], test(_a, myname, myage)); Here are the parentheses, and the ones inside are like parameters. What does it mean? And what is _a.raw?
迷茫2017-07-05 10:56:56
You can print template.raw
in the test
function of the first code, and you should know