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

96
Views
variable wrapped in square bracket

So I was reading the javascript file of a website and I saw a variable wrapped in square brackets, can someone explain to me what and why that is? I do understand the whole code and what It does except for that part. The variable I'm talking about is 'entry'.

const fadeIn = function (entries, observer) {
  const [entry] = entries;
  if (!entry.isIntersecting) return;
  entry.target.classList.add("scroll-reveal");
  observer.unobserve(entry.target);
};

const observer = new IntersectionObserver(fadeIn, {
  root: null,
  threshold: 0.5,
});

reveals.forEach((curr) => {
  observer.observe(curr);
});
about 4 years ago · Juan Pablo Isaza
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!