let funcs = [];
for (var i = 0; i < 3; i++) {
funcs.push(() => i);
}
console.log(funcs[0]());
console.log(funcs[1]());
console.log(funcs[2]());
function tag(strings, ...values) {
return strings.reduce((acc, str, i) => {
return acc + str + (values[i] ? values[i].toUpperCase() : '');
}, '');
}
const first = "hello";
const second = "world";
const result = tag`${first} and ${second} are great!`;
console.log(result);
function tag(strings, ...values) {
return strings[0] + values[0] * 2 + strings[1] + values[1] + strings[2];
}
const num1 = 5;
const num2 = 10;
const result = tag`Double ${num1} and add ${num2}!`;
console.log(result);