3 reasons JavaScript is great for AI | turalt

3 reasons JavaScript is great for AI

Have you ever thought of using JavaScript for AI? It might seem an unusual choice. Many AI companies these days use Python or Scala, but JavaScript has a few advantages that are worth thinking about when you’re looking at your next AI project.

1. Security

Unlike Python, JavaScript was built for security. After all, it was designed to allow someone you don’t trust, like Amazon or Google, to be able to run scripts on your computer without access to all your files and secrets. By design, JavaScript can’t access files or even the operating system. This makes it a great deployment framework for AI.

2. Performance

A lot of effort has gone into making JavaScript run really fast. And I mean a lot. One of the side effects of the competitive browser landscape has been heavy benchmarking, with JavaScript performance as a key metric in that competition. This means the likes of Apple, Google, and Microsoft have invested many many millions into making JavaScript run fast, and small, on their respective browsers. Long gone are the days when JavaScript was an interpreted language: modern JavaScript is translated into machine code in much the same way as Java, and in performance assessments they can be very competitive, especially for text manipulation.

3. Development time

JavaScript is very quick to develop, in much the same way as Python, but perhaps even more so. Both provide the interactive loop which makes debugging nice and easy, both have great development frameworks. There is great linting support for both, the standard development tools like VSCode support them well. I’m not a Python expert, but my experience has been that JavaScript is, if anything, faster to develop than the likes of Perl and Python.

Where Python has an advantage is the libraries, scikit-learn, and so on. There’s nothing in the JavaScript world that opens up GPU level of performance for deep learning. There are decent libraries (such as Synaptic) that can train moderate neural networks well. Synaptic has a delightful feature where it can take a trained neural network and export it as a raw JavaScript function as source code.

I might have been more negative about JavaScript before ES6 became so widely supported. I admit, I used to use CoffeeScript, because its arrow functions and classes made code much more readable — these are now standard in ES6, so 90% of the benefits of CoffeeScript are standard in all JavaScript platforms now.

All in all, JavaScript has the characteristics of a great AI language:

  • It’s built for security
  • It’s fast to run
  • It’s fast to develop
  • And it has a great pool of affordable talent

You don’t need to skill up for premium Python developers, you can bring in a JavaScript developer and get them working on AI today. We’d love to welcome more AI companies into using JavaScript for their technology too.


Tell me what you think: @turalt, stuart.watt@turalt.com

Dr. Stuart Watt has a PhD in the psychology of social intelligence and develops AI technologies that use psychological insights into organizational processes to improve email practice.

He is CTO of Turalt, a Toronto-based AI company using cognitive and psycholinguistic models to solve the negative impact of miscommunication in business.

Image © 45arseniy at 123RF Stock Photo, used with permission.