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

195
Visualizações
Javascript apostrophe not working (Mac2015 Catalina, Safari, Visual Studio)

A noob coder here. I'm trying to get into JavaScript and it doesn't like the idea. My main issue is that apostrophes in JS does not work on my computer. click for img

let images = [...document.querySelectorAll('.img')];
let slider = document.querySelector('.slider');
let sliderWidth;
let imageWidth;
let current = 0;
let target = 0;
let ease = .05;

images.forEach((img, idx) => {
 img.style.backgroundImage = 'url(./images/${idx+1}.jpeg)'
});

function lerp(start, end, t){
return start * (1-t) + end * t;
 }

function setTransform(el, transformat){
  el.style.transform = transform;
}
function init(){
  sliderWidth = slider.getBoundingClientRect().width;
   imageWidth = sliderWidth / images.lengh;
  document.body.style.height = '${sliderWidth - (window, innerWidth -   window, innerHeight)}px'
 }

Double quote single quote doesn't matter. At first I was using Atom, so I downloaded script, doesn't work. I've tried Sublime Text, also didn't work. Now I'm trying visual studio, it does not work...

I'm really lost as to how to fix the problem. My specs are: MacBook Pro 2015 Catalina 10.15.7, using Visual Studio, and my browser is Safari.

Please help!

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

0

You have to use the " ` " symbol instead of " ' " in order to make it work.

So :

`${sliderWidth - (window, innerWidth - window, innerHeight)}px`

Look here for a similar question already solved: How do I concatenate a string with a variable?

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