Although the name may be confusing, JavaScript is not the scripting language of Java. Often considered as a tool to build applications in your web browser, JavaScript is a versatile language offering many possibilities: frontend, backend, and many others.
Often neglected for this aspect, we will make you discover why JavaScript can also be considered as a language of choice to design your maintenance and server administration scripts, making it a general-purpose scripting language.
Unlike other dedicated scripting languages such as Ruby, or Bash, most developers have at least minimal knowledge of JavaScript. In fact, anyone who has dabbled in web programming has already used this language. If you write your maintenance scripts in JavaScript, you will have no trouble sharing them with your colleagues.
Moreover, it is a language that works on most platforms: personal computers as well as servers, Windows, Mac as well as Linux. With JavaScript, there is no need to write a different version of your code on your workstation.
Even if your main programming language is not JavaScript, most code editors and IDEs offer syntax highlighting and autocompletion of JavaScript code. Adding JavaScript code to the side of your main code will probably not be a problem for you, either in terms of implementation or management.
Although it has often had a bad reputation because of its lack of optimization in some implementations, today’s JavaScript is fast, with top-level concurrency support. If you need to manipulate large amounts of data or make many network calls in parallel, JavaScript will be able to provide you with an efficient and elegant solution, without wasting time, especially thanks to the use of promises.
In addition to being known by a large number of users, it is also a popular language with an active community on the web. Thus, you will have much less trouble looking for help on code written in JavaScript, than in a dedicated scripting language for your server.
Unlike other languages, such as Bash, JavaScript has a fairly large ecosystem of packages and libraries. If you need to perform a particular calculation or processing, it is very likely that someone has done it before you, and you can find a code library online that you can simply add to your script to get the desired result.
Also published here