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

163
Views
how to use IF logic to grab specific value

i'm new in javascript. i try to use if logic but i'm failed. My plan is if the zoom value is more than 5, the console.log show 'nice'. here are my code :

const zoom = mymap.setZoom(0);
if(zoom > 5) {
                console.log('nice')
            } else{
                console.log('not nice')
            }

the console.log always show 'not nice', how i can fix it?

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Assuming you're working with Maps JavaScript API, setZoom() doesn't return a value. As such, your variable zoom will always be undefined.

Instead, call getZoom() to set the variable properly, which returns a Number indicating "the zoom of the map":

const zoom = mymap.getZoom();
if(zoom > 5) {
    console.log('nice')
} else{
    console.log('not nice')
}
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!