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

189
Views
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 answers
Answer question

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 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!