Solution 1 :

use Regular expresseion

let regexp = new RegExp(username)

if (regexp.test(filename))
  // true

Solution 2 :

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.

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

Problem :

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!


Comment posted by epascarello

So have you figured out how to check if a file exists or is that what the question actually is?

By esgsw