Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

180
Views
Visual studio code is not recognising $ in javascript editor

I am writing the following code in my VS code editor.

let name="Sam";
const   val =  "I am  $ {name}";

console.log(val);

when I display it in console it should display" I am Sam" .But it is printing "I am $ {name}"

I have added extention of "JS ES6" and "Live Server" I am a beginner and unable to understand what I am doing wrong.

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

You need to define it as a template string, replace the " with ` and for the variable you have to remove the space between $ and {

let name="Sam";
const myval = `I am ${name}`;

console.log(myval);

For advanced description see here: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Template_literals

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!