It's nothing to do with Java.
NodeJS or Node.js is a server-side JavaScript engine built on Google Chrome's V8 JavaScript engine that can be used for both frontend and backend development.
Uses a non-blocking, event-driven architecture, making it ideal for building scalable and high-performance applications that handle a large number of simultaneous connections.
NodeJS operates on a single-threaded event loop model, but it uses non-blocking asynchronous I/O operations to handle concurrency efficiently
Like Python, NodeJS has a vast ecosystem of libraries, which you can search at npmjs.com.
NodeJS is used for everything from web development, to APIs and microservices, to CLI tools (although there are better languages for CLI like Golang, Python, Perl and Bash).
NodeJS Package Manager.
Install it using your system package manager and then use it to install your NodeJS libraries.
brew install npmOn any Mac or Linux, from DevOps-Bash-tools:
install_packages.sh npmNPM install package:
npm install "$package"Remember to commit the resulting package.json and package-lock.json files to Git.
Both files as in JSON format.
package.json- lists packages you've installed directlypackage-lock.json- lists the exact versions of all package dependencies so you can reproduce without annoying library version change related issues
Install all packages of the exact versions from ``packages-lock.json`:
npm installcurl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.2/install.sh | bashClones to ~/.nvm.
Reload shell to pick up the addition to .bashrc.
Show current node version:
nvm ls-> system
iojs -> N/A (default)
node -> stable (-> N/A) (default)
unstable -> N/A (default)
List available versions:
nvm ls-remoteInstall latest version of NodeJS:
nvm install nodeInstall specific version:
nvm install v23.11.0nvm use nodenode --versionv23.11.0
nvm ls-> v23.11.0
system
default -> node (-> v23.11.0)
iojs -> N/A (default)
unstable -> N/A (default)
node -> stable (-> v23.11.0) (default)
stable -> 23.11 (-> v23.11.0) (default)
...
To start an interactive Javascript shell, just type:
nodeThen behold this horror:
> "11" + 1
'111'
> "11" - 1
10Which brings us on to... strict variable typing...
Type safe superset of JavaScript with optional static type checking.
Transpiles (converts) to JavaScript eg. src/*.ts => dist/index.js.
Not compiles since it doesn't translate to binary or byte code.
Example variable type enforcement, just suffix the : <type> to a variable:
let name: string = "Hari";
name = 1; // type errornpm install -g typescripttsc example.ts
Generates example.js.
Run it:
node example.jsCreate a tsconfig.json for project settings:
tsc --initnpm install -g tsxtsxWelcome to Node.js v23.7.0.
Type ".help" for more information.
> 1 + 1
2
>
npm install -g ts-nodeStart the REPL:
ts-nodeList the packages:
npm ls -g ts-node typescript/opt/homebrew/lib
└─┬ ts-node@10.9.2
└── typescript@5.8.3
If you get an issue with REPL commands resulting in ... line continuation instead of returning the result.
ts-node
> 1 + 1
...
... ;
... ;
...
Use tsx instead.
cure53/DOMPurify - sanitize HTML to avoid XSS attacks.
You can see this used in my TamperMonkey script
jira_description_autofill.js.
https://github.com/highlightjs/highlight.js -
syntax highlighter





