Simple fs error in node js

console.log(“Starting app.js”);

const fs = require(‘fs’);
const os = require(‘os’);
const notes = require(’./notes.js’);

var user = os.userInfo();

fs.appendFile(‘greetings.txt’, ‘Hello ${user.username}! You are ${notes.age}.’, function(err) {
if(err) {
console.log(‘Unable to write to file’);
}
});

when i run this, the output in greetings.txt file is:
Hello ${user.username}! You are ${notes.age}.

It should specify the users name and age. Where is my mistake in this?

Try back-quote (above Tab probably) instead of single-quote key. Check here for more info.

Woah…it works. Thanks a lot mate.

Yeah, you need to be careful with this - using backquotes makes JS evaluate what’s inside the quotes, whereas normal quotation marks will not. It’s really easy to accidentally use normal quotes, which will just give you the literal string Hello ${user.username}! You are ${notes.age}. A syntax highlighter in the code editor should give you a clue: the literal string should be all one colour, whereas if you put it in backquotes it will highlight the stuff inside ${} in a different colour.