When comparing OCaml vs Javascript / GitHub Electron, the Slant community recommends OCaml for most people. In the question“What are the best languages to write a desktop Linux application in?” OCaml is ranked 3rd while Javascript / GitHub Electron is ranked 12th. The most important reason people chose OCaml is:
It steers you towards a functional style, but doesn't bother you with purity and "monads everywhere" like other languages, such as Haskell.
Specs
Ranked in these QuestionsQuestion Ranking
Pros
Pro Encourages functional style
It steers you towards a functional style, but doesn't bother you with purity and "monads everywhere" like other languages, such as Haskell.
Pro Actively-developed functional programming language at the forefront of research
Functional programming is based on the lambda calculus. OCaml is in its functional parts almost pure lambda calculus, in a very practical manner: useful for many daily programming tasks. The acitve development makes improvements to the type system like generalized algebraic data types (GADT) or polymorphic variants, so when learning this language you get at once a down to earth usable compiler and advanced abstraction features.
Pro Sophisticated and easy-to-use package manager
OPAM is a package manager for OCaml, which is really easy to use, just like npm. It creates a .opam folder in home directory.
The documentation is great as well, and you can switch between multiple versions of OCaml for each project. You can also package your project and publish it on OPAM repositories, even if the dependencies do not exists on OPAM.
Pro One of the best for writing compilers
OCaml is compiled to native binary, so it's amazingly fast. Being a member of ML-family languages, it has expressive syntax for trees, and has great LLVM support.
Pro Stable syntax
The syntax is consistent, some syntaxic sugar but at a reasonable level, so reading code of others isn't too much confusing.
Pro Strong editor integration
The merlin
editor tool provides all you need to develop OCaml in your favourite editor.
Pro Works on Linux, Windows, Mac
Being powered by Javascript, apps build with Electron can be packed to run on all 3 platforms.

Pro Wide spread support
Javascript is a very easy language to learn, and is handy for all manner of other things. There's a good chance you already know it, or that you will need to know it in the future.
Pro WebApps without additional work
If you don't require native features and could write a web app (i.e. a website with dynamic elements), then you could just extend it and turn it into a native app. This means that people just need to type your URL to use you app and may get more by downloading and installing it.
Cons
Con Strong focus on *nix systems, lacking native support for MS Windows
Lacks native support for Windows systems.
Con Low performance
Electron applications use significantly more CPU, RAM, and disk space than applications written in almost any other framework. This results in poor battery life as well as an unpleasant user experience.
Built By the Slant team
Our AI does all the product research work so you don’t have to.