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

99
Views
join is removing escape of escaped string

Why are the \ removed in the result and how can I prevent this? I need to keep the escaped string as it is.

const result = [
  'TITLE=Frontend',
  'DESCRIPTION=The\ frontend\ application'
].join('\n')

Expected result is:

TITLE=Frontend
DESCRIPTION=The\ frontend\ application

Update

The other way would be to join the string and escape the complete string after joining. I think this would be even better...

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

0

join() isn't removing anything. The backslash isn't in the original strings. It's just escaping the spaces, but space doesn't require escaping.

You need to escape the backslash if you need it to be included in the string literally.

const result = [
  'TITLE=Frontend',
  'DESCRIPTION=The\\ frontend\\ application'
].join('\n')

console.log(result);

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!