How to implement cheat codes (Javascript)

So I have already looked it up but the simplest one I found was C# and i only know JavaScript. So could someone either convert this into Js for me, or show me different Js code for cheats

private string[] cheatCode;
private int index;
 
void Start() {
    // Code is "idkfa", user needs to input this in the right order
    cheatCode = new string[] { "i", "d", "k", "f", "a" };
    index = 0;  
}
 
void Update() {
    // Check if any key is pressed
    if (Input.anyKeyDown) {
        // Check if the next key in the code is pressed
        if (Input.GetKeyDown(cheatCode[index])) {
            // Add 1 to index to check the next key in the code
            index++
        }
        // Wrong key entered, we reset code typing
        else {
            index = 0;  
        }
    }
 
    // If index reaches the length of the cheatCode string, 
    // the entire code was correctly entered
    if (index == cheatCode.Length) {
        // Cheat code successfully inputted!
        // Unlock crazy cheat code stuff
    }
}

Remove… Using unity engine at the begining
Remove … Class xample : mono behavior {}

Change the declaration to :
private var string cheat code;
private var index : int;

Instead of all " void" before functions replace with " function".
Rest of the code you posted doesn’t seem to require change.

Red.

Hi To All

you can use this plugin:

by thanks
myunitydream