Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

187
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda