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

114
Views
string concatenation and addition

When I try to do addition:

let x = "5" + 2 + 3;
//output 523

let x = 2 + 3 + "5";
// output 55

I know JavaScript concatenates the integers, but I was expecting "55" in both cases.

As 2+3 will be added to 5 and then concatenated to "5". Please can someone explain to me what is happening under the hood.

I am new to JavaScript.

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

0

The pluses are evaluated from left to right. So first "5"+2 is evaluated (result is "52"), and then "52"+3 gives "523".

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!