Node.js uses the value usage ${}, but console.log () still outputs ${} directly and does not replace it with a variable value.

1. In node.js, the value usage ${} is in a string, but in console.log output, the console gets a string with ${} and does not replace the value of the variable.

app.use(async (ctx, next) => {
    const start = new Date().getTime();
    await next();
    let ms = new Date().getTime() - start;
    console.log("Time: ${ms}ms");
});

as shown in the code above, take out the value of the variable ms with ${} in console.log (), but in the final console output, you get the following result:

Time: ${ms} ms

May I ask what"s going on?

Jun.02,2021

if you want to use a template string, you can't use single or double quotes ( " '), instead use backquotes ( `). Tab the one above.
such as:

var time = `Time: ${+new Date()}`;
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1eb5b39-2572.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1eb5b39-2572.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?