JavaScript is a powerful and beginner-friendly programming language that is widely used for websites, web applications, servers, and automation tasks. Android users can easily write and run JavaScript programs directly on their phones using Termux and Node.js, making it a simple way to learn coding and practice programming without a computer.
Installation Commands
First update your Termux packages:
pkg update && pkg upgrade -y
Install Node.js:
pkg install nodejs -y
Check the installed Node.js version:
node -v
Check npm version:
npm -v
Create a JavaScript file:
nano hello.js
Add this JavaScript code:
console.log("Hello World");Save the file using:
Press
CTRL + O
Press Enter and exit Nano using:
Press
CTRL + X
Usage & Basic Commands
Run the JavaScript file:
node hello.js
Print text in JavaScript:
console.log("Welcome to JavaScript");Create variables:
let name = "Termux";
console.log(name);
Simple addition program:
let a = 10;
let b = 20;
console.log(a + b);
Start interactive Node.js shell:
node
Install JavaScript packages using npm:
npm install package-name
Initialize a new Node.js project:
npm init
Remove installed packages:
npm uninstall package-name
Exit Node.js interactive mode:
.exit
These basic JavaScript and Node.js commands help beginners create scripts, run JavaScript files, install packages, and practice coding easily directly on Android using Termux.







