已成功安装Node.js!哦,但为什么这段代码没有渲染?

Ram*_*ona 0 javascript node.js

输出是

{$questions[i]}
Run Code Online (Sandbox Code Playgroud)

它没有提出我的第一个问题!

这是代码:

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);
Run Code Online (Sandbox Code Playgroud)

我错过了什么?

Ste*_*her 6

你很亲密!模板文字语法${}不是{$}.所以你要找的是:

这很容易混淆,因为大多数前端模板引擎使用花括号作为包装{...}.

process.stdout.write(`\n\n ${questions[i]} \n\n `);
Run Code Online (Sandbox Code Playgroud)