-4

I created a JavaScript program and want to share it with my friends as an application. But ,I don't want to reveal my coding and want to share it as an application.

  • You can't protect the source code because JavaScript is an interpreted language so the web browser reads the raw source code rather than a compiled version. The best you can do is to obfuscate your code using tools which "minify" your code by reducing variable names to single/double letters, and removing newlines and whitespace where possible. This makes code much harder to read, but still not impossible. – Bobulous Jun 02 '18 at 10:38
  • 2
    Side note: There's a very good chance you're trying to do this for the wrong reasons. The various `if` statements and `for` loops that make up your program logic aren't trade secrets. Step back from the goal of code obfuscation for a moment and assess your real goal. What specifically are you trying to protect, protect *from what*, and why? – David Jun 02 '18 at 10:40

1 Answers1

0

Currently there is no foolproof way to hide your javascript code since its made to run on the browser however you can minify your code. You can use bundlers to do this task for you. Use webpack, roolup.

paudel
  • 462
  • 4
  • 15