All cheatsheetsOpen JavaScript editor

JavaScript Online Compiler

Write, Run & Share JavaScript code online using CodeCompiler's JS online compiler for free. It's one of the robust, feature-rich online compilers for JavaScript language, running the latest Node version. Getting started with the CodeCompiler's JavaScript editor is easy and fast.

About JavaScript

JavaScript (JS) is the most popular lightweight, interpreted compiled programming language, created by Brendan Eich in 1995. It is a high-level, often just-in-time compiled, multi-paradigm language used for building Web pages.

Key features

  • Free
  • Online
  • Real-time output
  • Easy & fast
  • No setup or installation required

Variables

Use `let`, `const`, or `var` to declare variables.

let name = "World";
const PI = 3.14;
console.log("Hello, " + name);

Loops

for (let i = 0; i < 5; i++) {
  console.log(i);
}

Functions

function add(a, b) {
  return a + b;
}
console.log(add(2, 3));