So, I am writing a game with JavaScript, and the biggest problem is that the one who plays it, who can have a decent knowledge of JS, can open my source code, find out how it works, and then plug it game.score = 100000000000000;into the console. However, it seems that besides obfuscating the script, wrapping everything in an anonymous function does the trick.
(function() {
game_start = function() {
}
})();
When I try to run any code from the Chrome console, it has undefined. This is the desired result, but is there a way around my method that will make it useless? Or even the best way to prevent applications from launching from the console?
source
share