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

178
Views
Can we declare with let or var inside of an if conditional statement?

It seems like we are allowed to declare variables inside of conditional statements with inferred globals:

if(xo = 30){
            let iffy = true;
        }

However, is there a way or are we allowed to declare a variable with an 'let' or 'var' inside of an conditional statement? It would be something like the following:

if(var xo = 30){
            let iffy = true;
        }

The above code throws an exception but it's showing what i'm trying to achieve. With for loops it does allow declaraton of variables with an 'let' and 'var' in it's conditional statement. Could we replicate this for an if loop?

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!