输出
{$questions[i]}
并没有提出我的第一个问题!
这是代码:
var questions = [
"What is your name?",
"What is your favorite fruit?",
"What is the meaning of life?"
];
var answers = [];
function ask(i){
process.stdout.write(`\n\n {$questions[i]} \n\n `);
process.stdout.write(" > ");
}
ask(0);
我错过了什么?
答案 0 :(得分:6)
你关闭了!模板文字语法为${}
,而不是{$}
。所以你要找的是:
这很容易混淆,因为大多数前端模板引擎使用花括号作为包装{...}。
process.stdout.write(`\n\n ${questions[i]} \n\n `);