.js
Use cautionJavaScript
Source for the language that runs the web — in browsers and on servers (Node.js, Bun, Deno). Central to interactive UIs and modern tooling.
MIME types
- text/javascript
- application/javascript
Category
web
Aliases
.mjs / .cjs
What opens this file
- VS Code
- WebStorm
- Sublime Text
- Browsers / Node.js
How to open by OS
Windows
- Browsers, Node.js, Bun, Deno.
Mac
- Same.
Linux
- Same.
Ios
- Working Copy, Koder.
Android
- Acode, Termux.
Safety notes
- Loading untrusted scripts exposes users to XSS. Combine CSP with Subresource Integrity (SRI) when hotlinking.
- Careless npm installs can run arbitrary install-time scripts — verify package provenance and maintainers.
Common mistakes
- Code written for the browser and for Node.js is not always interchangeable (
importvsrequire). Configure a bundler target explicitly. - Mixing
.mjsand.cjsin the same tree makes Node.js emit module-resolution warnings.