Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

184
Visualizações
why does my template literal doesn't work in javascript in visual studio code

I'm beginner with java script, and I am practicing with mdn document.

the code I wrote is working differently with what is written on mdn as below.

    "use strict";

    let bigInt = 34321321321;
    console.log("value: ${bigInt}");

    let a = 5;
    let b = 10;
    console.log("fifteen is ${a+b}");

I just added script tag on index.html, which is default html file.

enter image description here

I did it on google chrome.

what could be the problem?

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

To use ${variable} you should use back tick ` not double qoutes "".

Back ticks use variables with ${}. If you don't use back ticks then the variable should be applied like below,

let variable = 123213;

console.log("The variable is" + variable);

If ${} is used then,

let variable = 123213;

// backticks are used without double qoutes(")
console.log(`The variable is ${variable}`);

Also there is a MDN reference.

about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda