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

161
Views
JS question "i dont know why i am getting a different answer"

let a = 10;

let b = "20";

let c = 80;

console.log(--c + +b + --a * +b++ - +b * a + --a - +true);

**I think I should get 108 then multiple it by -1 then multiple it by 16 which should result in -1728 however I am getting an answer of 97!!!!

how is that possible?

when I broke the problem into 3 pieces (--c + +b + --a)(+b++ - +b)(a + --a - +true) the computer agreed with me that the first part should be 108 then -1.

I need help guys. someone explain it to me, please.

THANKS**

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

0

This is because of order/preference of operations. as multiplication has higher preference than addition and subtraction.

just put bracers like below it will give required output (-1728).

console.log((--c + +b + --a) * (+b++ - +b) * (a + --a - +true));
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!