MZ Can I check if a save file exists by script?

I want to turn on a specific switch if I have a save file.

example : Switch 1 on if save file 1 exists.
Switch 2 on if save file 2 exists.
I want to turn on a specific switch if I have a save file.

example : Switch 1 on if save file 1 exists.
Switch 2 on if save file 2 exists.
Code:
DataManager.savefileExists(saveSlot)

Code:
if (DataManager.savefileExists(1)) {
    $gameSwitches.setValue(1, true);
}
Code:
DataManager.savefileExists(saveSlot)

Code:
if (DataManager.savefileExists(1)) {
    $gameSwitches.setValue(1, true);
}

Thank you for your help!

Original thread: https://forums.rpgmakerweb.com/threads/can-i-check-if-a-save-file-exists-by-script.151989/