Rohit Kumar
Rohit Kumar

Reputation: 29

console.log is unable to fetch port variable, i've provided the screenshots

In my javascript program I've already declared the port variable, but it is not working when I use $port inside console.log function.

Here's the snapshot of my console.

Upvotes: 0

Views: 113

Answers (2)

Karan Garg
Karan Garg

Reputation: 1103

Instead of single quotes '${port}' try to use backticks ``

Upvotes: 0

rsp
rsp

Reputation: 111506

Use backticks instead of single quotes:

console.log(`Text ${variable}`);

instead of:

console.log('Text ${variable}');

See:

Upvotes: 2

Related Questions