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

137
Views
How do I check if a file name includes a variable in javascript?

So I am trying to make a save file system thing, and it creates a file with your username, but when you log in it checks the user saves file to see if theres a file called "[username]_save.txt", but I'm not sure how to do it with a username variable. Could someone help me out? thanks!

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

0

use Regular expresseion

let regexp = new RegExp(username)

if (regexp.test(filename))
  // true
about 4 years ago · Juan Pablo Isaza Report

0

Without additional code and examples of what you have so far it's a shot in the dark to help you, but here's a thought:

Use concatenation or template literal to incorporate the username into the filename you are looking for.

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Template_literals

If you have more info on the issue we can provide more help!

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!