Are bots created in glitch automatically strict js?

I wanted to start using strict mode for my bot but then tested to see if works (Tried to delete a local variable) But realized it throws the same error activating or not the strict mode

let test
delete test //Syntax Error: Tried to delete local variable in strict mode

Is all the code already in strict?

I don’t think that’s how you use the delete keyword, it’s used to delete properties I think

the delete keyword in javascript was created to delete properties of an object and should not be used to attempt to delete variables as variables will either way dissolve when they are no longer used. You can use the delete keyword on objects such as sets, maps or normal objects.

I.e. delete obj["key"].

1 Like

I know right? Did you guys read the post? I know delete throws the error but in non strict JS the silent error is minimized and won’t stop the code, you can check if some code is strict by doing that…

Can you answer or I’ll just deduct glitch works automatically in strict JS?

Most likely just the linter being in strict mode. Glitch doesn’t change the behaviour of any of your code.

Mmmm ok Ill try with eval command, if works then is non strict, at least I guess it will show me if something strict error like is happening

I got no error using eval, that means I have to manually activate it on every script! Tho the linter is in strict mode.

Or you could set node’s command line option in package.json …

"start": "node --use_strict server.js"

Edit - this also applies strict to external modules, which may not work out depending how they’re written.

Didn’t knew that was a way!