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

187
Views
How to simplify the expression "data && data.pwd && data.pwd.length"?

I'm sorry if this question has been asked several times and in much clearer terms, but I just don't know the technical term for what I'm looking for. I'm trying to write a conditional statement in the following way:

if (data && data.password && data.password.length > 7) {// Do something}

But I know there is a simpler way to write this. Something like

if (data?password?length > 7) {// Do something}

What would be the correct formulation? What is the technical term for this type of expressions?

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

0

Concept you are looking for is called Optional Chaining

You can modify to : data?.password?.length

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!